Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Add migration backfill for mptoken_issuance_history#3128

Open
BryanJ1ang wants to merge 12 commits into
XRPLF:developfrom
BryanJ1ang:brjiang-mpt-rpc-migration
Open

feat: Add migration backfill for mptoken_issuance_history#3128
BryanJ1ang wants to merge 12 commits into
XRPLF:developfrom
BryanJ1ang:brjiang-mpt-rpc-migration

Conversation

@BryanJ1ang

@BryanJ1ang BryanJ1ang commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Note: this PR depends on previous ETL indexing PR here

Summary

Adds MPTTransactionHistoryMigrator, a Cassandra migration that backfills historical MPT issuance transaction history into the new MPT index tables:

  • mptoken_issuance_transactions
  • account_mptoken_issuance_transactions

The migrator full-scans the transactions table, reuses the live ETL MPT extractor, writes the same deterministic index rows produced by live indexing, and waits for queued async writes before marking the migration as complete.

Details

  • Registers MPTTransactionHistoryMigrator with the Cassandra migration manager.
  • Uses migration scan settings for full-table scanning:
    • migration.full_scan_threads
    • migration.full_scan_jobs
    • migration.cursors_per_job
  • Adds Cassandra driver paging support so token-range scans read all result pages.
  • Makes migration scans select explicit columns instead of relying on table column order.
  • Propagates full-table scanner worker failures so failed scans do not get marked migrated.
  • Keeps the migration non-blocking for Clio startup.

Testing

Added coverage for:

  • Migrator status before and after running.
  • Backfilling MPT issuance create paths and multi-issuance transaction fan-out.
  • Idempotent reruns.
  • Empty transaction tables.
  • Parity between migration backfill rows and live ETL rows.
  • Failed transactions with explicit MPT issuance references.
  • Cassandra paging across more than one driver page.
  • Full-table scanner validation and worker error propagation.

@BryanJ1ang BryanJ1ang force-pushed the brjiang-mpt-rpc-migration branch from f6677be to a0b2942 Compare July 6, 2026 16:44
@BryanJ1ang BryanJ1ang force-pushed the brjiang-mpt-rpc-migration branch from a0b2942 to 891846e Compare July 7, 2026 16:59
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.43243% with 50 lines in your changes missing coverage. Please review.
βœ… Project coverage is 82.50%. Comparing base (52d28f8) to head (891846e).

Files with missing lines Patch % Lines
.../migration/cassandra/CassandraMigrationBackend.hpp 0.00% 33 Missing ⚠️
...ration/cassandra/MPTTransactionHistoryMigrator.cpp 0.00% 14 Missing ⚠️
src/migration/MigrationApplication.cpp 0.00% 2 Missing ⚠️
src/main/Main.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3128      +/-   ##
===========================================
- Coverage    82.65%   82.50%   -0.15%     
===========================================
  Files          398      399       +1     
  Lines        16118    16169      +51     
  Branches      8443     8476      +33     
===========================================
+ Hits         13323    13341      +18     
- Misses        1674     1707      +33     
  Partials      1121     1121              

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

BryanJ1ang and others added 7 commits July 7, 2026 16:00
Statement.hpp and Collection.hpp each carried a private static copy of
the same CassError-to-logic_error helper; both now use one shared free
function in data::cassandra::impl.

Co-Authored-By: Claude Fable 5 <[email protected]>
…nst ref

A transaction that fails to deserialize is a deterministic data error, so
rerunning the migration could never get past it; log and skip the row
instead of permanently wedging the backfill. Callback and DB read errors
still fail closed. The scan callback now takes STTx/TxMeta by const ref,
removing a deep copy per scanned row.

Co-Authored-By: Claude Fable 5 <[email protected]>
Buffer extracted records across transactions and flush in batches
(mirroring the live ETL path's per-ledger accumulation) so the backend
coalesces them into full-size write batches instead of submitting one
tiny write pair per transaction.

Co-Authored-By: Claude Fable 5 <[email protected]>
The warning was not operator-actionable and per-tx fanout beyond the
threshold should not occur in practice; the Prometheus counter still
tracks index rows written.

Co-Authored-By: Claude Fable 5 <[email protected]>
Key the prepared-statement cache by table name alone (partition key and
select columns are fixed per TableDesc), replace the rowsRead counter
with a bool, and author the read-failure message once for both the log
and the thrown exception.

Co-Authored-By: Claude Fable 5 <[email protected]>
The TableSpec concept now requires the kSelectColumns list to have
exactly one column per Row tuple element, so the two cannot silently
drift when columns are added or removed.

Co-Authored-By: Claude Fable 5 <[email protected]>
@BryanJ1ang BryanJ1ang marked this pull request as ready for review July 8, 2026 16:16
@BryanJ1ang

Copy link
Copy Markdown
Contributor Author

/ai-reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant