IntersectMBO / cardano-db-sync

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL
Apache License 2.0
292 stars 161 forks source link

[cardano-db-sync - 13.3.0.0] Error:Inconsistent migrations found #1807

Closed saravadeanil closed 3 months ago

saravadeanil commented 3 months ago

OS Your OS:

Versions The db-sync version (eg cardano-db-sync --version): 13.3.0.0 PostgreSQL version: 14.10-alpine

Build/Install Method The method you use to build or install cardano-db-sync: Official docker image

Run method The method you used to run cardano-db-sync (eg Nix/Docker/systemd/none): Kubernetes with below command:-

cardano-db-sync
--config=/cardano-configurations/network/mainnet/cardano-db-sync/config.json
--socket-path=/node-ipc/node.socket --state-dir=/data
--schema-dir=/schema

Additional context Add any other context about the problem here.

I tried to upgrade my cardano-db-sync from 13.2.0.2 to 13.3.0.0 and I am facing error on both preview + mainnet network. I am using these schema files LINK.

Problem Report Please do not include screenshots or images, but instead cut and paste any relevant log messages or errors.

[db-sync-node:Info:6] [2024-08-07 12:43:50.99 UTC] Version number: 13.3.0.0
[db-sync-node:Info:6] [2024-08-07 12:43:50.99 UTC] Git hash: d21895fec3a9445493b6ff4aa61b8dcb5153de1e
[db-sync-node:Info:6] [2024-08-07 12:43:50.99 UTC] Enviroment variable DbSyncAbortOnPanic: False
[db-sync-node:Info:6] [2024-08-07 12:43:50.99 UTC] SyncNodeParams {enpConfigFile = ConfigFile {unConfigFile = "/cardano-configurations/network/mainnet/cardano-db-sync/config.json"}, enpSocketPath = SocketPath {unSocketPath = "/node-ipc/node.socket"}, enpMaybeLedgerStateDir = Just (LedgerStateDir {unLedgerStateDir = "/data"}), enpMigrationDir = MigrationDir "/schema", enpPGPassSource = PGPassDefaultEnv, enpEpochDisabled = False, enpHasCache = True, enpSkipFix = False, enpOnlyFix = False, enpForceIndexes = False, enpHasInOut = True, enpSnEveryFollowing = 500, enpSnEveryLagging = 10000, enpMaybeRollback = Nothing}
[db-sync-node:Info:6] [2024-08-07 12:43:50.99 UTC] SyncOptions {soptEpochAndCacheEnabled = True, soptAbortOnInvalid = False, soptCache = True, soptSkipFix = False, soptOnlyFix = False, soptPruneConsumeMigration = PruneConsumeMigration {pcmPruneTxOut = False, pcmConsumeOrPruneTxOut = False, pcmSkipTxIn = False}, soptInsertOptions = InsertOptions {ioTxCBOR = False, ioInOut = True, ioUseLedger = True, ioShelley = True, ioRewards = True, ioMultiAssets = True, ioMetadata = True, ioKeepMetadataNames = Nothing, ioPlutusExtra = True, ioOffChainPoolData = True, ioPoolStats = False, ioGov = True, ioRemoveJsonbFromSchema = False}, snapshotEveryFollowing = 500, snapshotEveryLagging = 10000}
[db-sync-node:Error:6] [2024-08-07 12:43:50.99 UTC] Inconsistent migrations found:
Migrations missing at runtime that were present at compilation time: ["migration-1-0012-20240211.sql","migration-1-0013-20240318.sql","migration-1-0014-20240411.sql","migration-2-0034-20240301.sql","migration-2-0035-20240308.sql","migration-2-0036-20240318.sql","migration-2-0037-20240403.sql","migration-2-0038-20240603.sql","migration-2-0039-20240703.sql","migration-2-0040-20240626.sql","migration-2-0041-20240711.sql","migration-3-0004-20240603.sql","migration-4-0004-20210116.sql","migration-4-0008-20240604.sql"]
Migrations found at runtime that were missing at compilation time: ["migration-4-0004-20210116.sql"]
cardano-db-sync: UnknownMigrationsFound {missingMigrations = [MigrationValidate {mvHash = "52664a8126a2dc7ea7e056f128a7e0d445150626156534726eee4e3ec4315207", mvFilepath = "migration-1-0012-20240211.sql"},MigrationValidate {mvHash = "32db9b75e4a229e3bb3d83bba618d04e7c22c979fbb8caaa97be7cb31e8c7b6e", mvFilepath = "migration-1-0013-20240318.sql"},MigrationValidate {mvHash = "199ff114c4bd55e0aeb0ddc3c483d40f9e4fc5d92e4a23653e995d99b71ed71d", mvFilepath = "migration-1-0014-20240411.sql"},MigrationValidate {mvHash = "16feeeb802b56ec51d4401a35a62bd4c287da4df83838d1fad0b856d7f481b84", mvFilepath = "migration-2-0034-20240301.sql"},MigrationValidate {mvHash = "411520d59440ae5ce97633ea3363e4f22eaf2e38b758fc6746d10cf997278dac", mvFilepath = "migration-2-0035-20240308.sql"},MigrationValidate {mvHash = "56fa412ef2e22ebeb83e580bf85d792148169b2f36b25e7f14eb447595eb880c", mvFilepath = "migration-2-0036-20240318.sql"},MigrationValidate {mvHash = "be381a36339fb1431b79fa837d5f4f02dc7a75306b79aafa34ea2822a57ff7d6", mvFilepath = "migration-2-0037-20240403.sql"},MigrationValidate {mvHash = "028fe1eee382912efcaacfaf201ac174ae7e5dfba5f336191949e65d9f0186b0", mvFilepath = "migration-2-0038-20240603.sql"},MigrationValidate {mvHash = "aa75e036037d32f7a9b90c3c548fbb83daa227be498aa605ff49fd11504ce26e", mvFilepath = "migration-2-0039-20240703.sql"},MigrationValidate {mvHash = "3c8b78b4f7768f8eed3fc79bbd2a23f696bee797d0b73901e2b35d694035549a", mvFilepath = "migration-2-0040-20240626.sql"},MigrationValidate {mvHash = "9dacbb489e5eb2b26fa1b2d3d7472711a8e6d20c5da6ddc6309baee38eec6ef4", mvFilepath = "migration-2-0041-20240711.sql"},MigrationValidate {mvHash = "0867f9b3552594a22ee3c03588d2f5024ebadc74c29dedc4e15d524c17755b02", mvFilepath = "migration-3-0004-20240603.sql"},MigrationValidate {mvHash = "80c9eb1e738541352868610099253741bde8e4f53b6f1303092015019d4d84a1", mvFilepath = "migration-4-0004-20210116.sql"},MigrationValidate {mvHash = "f93506c5d21c006e9466031369558a89a6285792589d6f72b962d0698cfb62ee", mvFilepath = "migration-4-0008-20240604.sql"}], extraMigrations = [MigrationValidate {mvHash = "6dc7b1121ea8ec341aba1e8e4d1efc4c0963fc92c053ffd14dabb9effe57f43c", mvFilepath = "migration-4-0004-20210116.sql"}]}
saravadeanil commented 3 months ago

Hi, is there a fix for above issue?

sgillespie commented 3 months ago

This error indicates that the schema directory is different than when db-sync was built. According to the message, the missing files are present in the link you just shared above. My suspicion is the schema dir does not actually point to where you think it does.

sgillespie commented 3 months ago

Also note that you do not have to pass --schema-dir in the docker image, it is embedded in the startup script

saravadeanil commented 3 months ago

Thanks..I will double check 👍

saravadeanil commented 3 months ago

Closing this issue since I was able to fix the error. Thanks for the help 🙌 @sgillespie