coder13 / coder13/LetsCube

Backfill MongoDB data into PostgreSQL and verify ongoing parity

Đang mở
#175 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: data enhancement priority: P1
Ngôn ngữ chính
JavaScript
Star
30
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Part of #199.

## Goal

Turn PostgreSQL dual writes into a trustworthy migration target by copying historical MongoDB data and continuously checking parity.

For the competition-room foundation, this backfill must target the new Room/RaceSession model rather than preserving the current assumption that a room is itself one racing session.

## RaceSession mapping

- Convert each existing MongoDB room into one PostgreSQL Room plus one RaceSession for its current event.
- Attach every embedded attempt to that RaceSession while preserving deterministic attempt and solve IDs.
- Populate session participant state according to the approved domain contract.
- Preserve room identity, access code, ownership, privacy, timestamps, and deletion/expiration state.
- Make the mapping explicit and repeatable; do not attempt to infer event sessions whose attempts were already deleted by the legacy event-change behavior.
- Verify concurrent live writes are neither lost nor duplicated during the backfill.

## Acceptance criteria

- [ ] Implement an idempotent, resumable backfill for users/preferences, rooms, race sessions, participant state, attempts, durable solve results, and sanitized metrics.
- [ ] Support dry-run, bounded batches, progress checkpoints, and safe retries.
- [ ] Do not copy OAuth access tokens or prohibited metric fields.
- [ ] Produce reconciliation output for record counts, missing identifiers, duplicate identifiers, room/session relationships, penalty fields, and representative aggregates.
- [ ] Verify every attempt belongs to the expected RaceSession and every RaceSession belongs to the expected Room.
- [ ] Verify writes arriving during the backfill are not lost or duplicated.
- [ ] Document operational invocation, expected runtime/load, alerts, failure recovery, and how to rerun only failed ranges.
- [ ] Add focused tests for deterministic IDs, cursor boundaries, retry behavior, session mapping, and reconciliation failures.

## Dependencies

- Stable production dual writes from PR #171, deployed through #176.
- The Room/RaceSession domain contract and expansion schema from #200 and #203.
- The schema and migration history must remain compatible with rollback requirements.

## Unlocks

- #202
- #174
- #160

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với domain contract và expansion schema của Room/RaceSession từ #200 và #203, sau đó xem xét ngữ cảnh dual-write và deployment trong PR #171 và #176 cùng với lịch sử schema migration. Truy vết các mappings bắt buộc và các ràng buộc rollback trước khi xác định resumable backfill. Được xem là hoàn tất khi các kiểm tra reconciliation, retry và concurrency, các bài test tập trung và tài liệu vận hành bao quát các tiêu chí chấp nhận được liệt kê.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
mongodb, postgresql
Lĩnh vực
databases
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.