Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to the bootstrap flow #9717

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

nirbosl
Copy link
Contributor

@nirbosl nirbosl commented Nov 8, 2024

Description:

  • Added the CREATE_MIRROR_API_USER env var to bootstrap.env, defaults to true
  • Add CREATE_MIRROR_API_USER as an OR condition to init.sh for the creation of the mirror_api user if $SCHEMA_V2 or $CREATE_MIRROR_API_USER are true.
  • Update INIT_SH_URL in bootstrap.sh to download the init script from main branch rather than the respective version tags where it still contains the old version of init.sh.
  • Remove the MIRRORNODE_VERSION variable from bootstrap.sh as it is no longer being used anywhere in the script following the change to INIT_SH_URL.
  • Update bootstrap.md docs: add an entry at the end of the process to start the mirrornode importer.

Related issue(s):

Notes for reviewer:
I've used this process to test the changes:

  • Setup a Cloud SQL DB
  • Download the small table files from the GCS bucket (0.111.0 to match Quicknode's)
  • Use the bootstrap.sh and init.sh updated code in this PR to bootstrap the tables' data into the cloud sql instance while setting CREATE_MIRROR_API_USER to true for the mirror_api user to be created.
  • Queried flyway_schema_history table to verify there's no entry "0"; The results begin with "1.0" from 2019-09-09.
  • Started a local mirrornode-importer configured to work against mainnet's bucket and the bootstrapped DB instance, everything looks normal:
2024-11-08T17:18:18.499Z  INFO main c.h.m.i.ImporterApplication No active profile set, falling back to 1 default profile: "default"
2024-11-08T17:18:21.813Z  INFO main o.f.c.i.c.DbMigrate Current version of schema "public": 1.99.1
2024-11-08T17:18:21.825Z  INFO main o.f.c.i.c.DbMigrate Migrating schema "public" with repeatable migration "01 temp tables"
2024-11-08T17:18:22.014Z  INFO main o.f.c.i.c.DbMigrate Successfully applied 1 migration to schema "public" (execution time 00:00.128s)
2024-11-08T17:18:25.998Z  INFO main c.h.m.i.c.CloudStorageConfiguration Configured to download from bucket hedera-mainnet-streams
2024-11-08T17:18:26.057Z  INFO main c.h.m.i.c.CloudStorageConfiguration Setting up GCP client using provided access/secret key
2024-11-08T17:18:26.339Z  INFO main c.h.m.i.c.CloudStorageConfiguration Setting up S3 client using provided access/secret key
2024-11-08T17:18:28.124Z  INFO main c.h.m.i.c.MetricsConfiguration Collecting 59 table metrics: [custom_fee, entity_stake_history, ethereum_transaction, file_data, prng, crypto_allowance_history, address_book_entry, contract_action, transaction_hash, contract_state, entity_transaction, live_hash, assessed_custom_fee, token_balance, contract, token_account, account_balance_file, node_history, record_file, entity_stake, entity_history, topic_message_lookup, node, address_book_service_endpoint, nft, non_fee_transfer, account_balance, contract_state_change, transaction_signature, custom_fee_history, nft_history, nft_allowance_history, staking_reward_transfer, token_allowance_history, contract_transaction_hash, sidecar_file, node_stake, contract_result, crypto_transfer, network_stake, contract_transaction, transaction_child, entity_bkup, reconciliation_job, token_account_history, token_history, network_freeze, token_transfer, address_book, token, schedule, topic_message, contract_log, flyway_schema_history, token_allowance, crypto_allowance, nft_allowance, entity, transaction]
2024-11-08T17:18:28.253Z  INFO main c.h.m.i.ImporterApplication Started ImporterApplication in 10.531 seconds (process running for 10.834)
2024-11-08T17:18:28.369Z  INFO main c.h.m.i.d.PartitionMaintenance Running partition maintenance
2024-11-08T17:18:28.415Z  INFO main c.h.m.i.d.PartitionMaintenance Partition maintenance completed successfully in 46.06 ms
2024-11-08T17:18:28.427Z  INFO task-1 c.h.m.i.p.r.e.s.EntityStakeCalculatorImpl Skipping since the entity stake is up-to-date
2024-11-08T17:18:28.451Z  WARN scheduling-1 c.h.m.i.a.AddressBookServiceImpl Using address book 1724363804236820004 with 31 nodes and node stake 1724716800004544831 with 32 nodes
2024-11-08T17:18:28.457Z  INFO scheduling-1 c.h.m.i.c.DateRangeCalculator RECORD: downloader will download files in time range (2024-08-27T17:03:28.009025003Z, 2262-04-11T23:47:16.854775807Z]
2024-11-08T17:18:30.178Z  INFO scheduling-1 c.h.m.i.d.r.RecordFileDownloader Downloaded 775 signatures in 1.922 s (404/s): {2024-08-27T17_03_34.006507599Z.rcd_sig=30, 2024-08-27T17_03_36.017236201Z.rcd_sig=30, 2024-08-27T17_03_38.009493757Z.rcd_sig=30, 2024-08-27T17_03_30.004115003Z.rcd_sig=30, 2024-08-27T17_03_46.008792003Z.rcd_sig=30, 2024-08-27T17_03_42.022197003Z.rcd_sig=30, 2024-08-27T17_03_40.000203252Z.rcd_sig=30, 2024-08-27T17_03_32.004991003Z.rcd_sig=30, 2024-08-27T17_03_44.000035744Z.rcd_sig=30, 2024-08-27T17_03_48.021740678Z.rcd_sig=30}
2024-11-08T17:18:30.404Z  INFO pool-7-thread-2 c.h.m.i.c.DateRangeCalculator RECORD: parser will parse items in DateRangeFilter([2024-08-27T17:03:28.009025003Z, 2262-04-11T23:47:16.854775807Z])
2024-11-08T17:18:30.466Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 1 rows to contract_log table in 10.13 ms
2024-11-08T17:18:30.502Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 1680 rows to crypto_transfer table in 34.53 ms
2024-11-08T17:18:30.602Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 35 rows to entity_temp table in 24.21 ms
2024-11-08T17:18:30.608Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 1 rows to record_file table in 3.588 ms
2024-11-08T17:18:30.622Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 411 rows to topic_message table in 13.52 ms
2024-11-08T17:18:30.639Z  INFO pool-7-thread-2 c.h.m.i.p.b.TransactionHashBatchInserter Copied 8 rows from 8 shards to transaction_hash table in 17.06 ms
2024-11-08T17:18:30.669Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 3 rows to token_account_temp table in 16.39 ms
2024-11-08T17:18:30.689Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 419 rows to transaction table in 18.24 ms
2024-11-08T17:18:30.695Z  INFO pool-7-thread-2 c.h.m.i.p.b.BatchInserter Copied 2 rows to token_transfer table in 4.392 ms
2024-11-08T17:18:30.696Z  INFO pool-7-thread-2 c.h.m.i.p.r.e.s.SqlEntityListener Completed batch inserts in 242.9 ms
2024-11-08T17:18:30.709Z  INFO pool-7-thread-2 c.h.m.i.p.r.RecordFileParser Successfully processed 419 items from 2024-08-27T17_03_30.004115003Z.rcd.gz in 322.0 ms

Checklist

  • Documented (Code comments and bootstrap.md)
  • Tested (test process steps described in the notes section)

@nirbosl nirbosl requested a review from a team as a code owner November 8, 2024 19:01
@steven-sheehy steven-sheehy added this to the 0.118.0 milestone Nov 8, 2024
@steven-sheehy steven-sheehy added the bug Type: Something isn't working label Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.23%. Comparing base (a0d93a0) to head (b047589).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9717      +/-   ##
============================================
- Coverage     92.23%   92.23%   -0.01%     
  Complexity     7628     7628              
============================================
  Files           937      937              
  Lines         32121    32121              
  Branches       4070     4070              
============================================
- Hits          29627    29626       -1     
  Misses         1542     1542              
- Partials        952      953       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs/database/bootstrap.md Outdated Show resolved Hide resolved
docs/database/bootstrap.md Show resolved Hide resolved
@steven-sheehy steven-sheehy changed the title Fixes to the bootstrap flow in v1 DBs Fixes to the bootstrap flow Nov 8, 2024
Copy link
Member

@steven-sheehy steven-sheehy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@xin-hedera xin-hedera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@steven-sheehy steven-sheehy merged commit 89eb806 into hashgraph:main Nov 8, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants