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

tapdb: add support for logging migrations #772

Merged
merged 1 commit into from
Jan 26, 2024
Merged

tapdb: add support for logging migrations #772

merged 1 commit into from
Jan 26, 2024

Conversation

Roasbeef
Copy link
Member

In this commit, we add support for logging migrations as they happen. This is useful for users to keep track of what happens during a tapd update.

@Roasbeef
Copy link
Member Author

Sample run from a unit test we have:

2024-01-26 14:34:19.569 [INF] TADB: Applying migrations from version=0
2024-01-26 14:34:19.586 [INF] TADB: 1/u macaroons (16.242875ms)

2024-01-26 14:34:19.586 [INF] TADB: Applying migrations from version=1
2024-01-26 14:34:19.605 [INF] TADB: 2/u assets (18.767541ms)

2024-01-26 14:34:19.623 [INF] TADB: 3/u addrs (36.842791ms)

2024-01-26 14:34:19.639 [INF] TADB: 4/u mssmt (52.773834ms)

2024-01-26 14:34:19.658 [INF] TADB: 5/u transfers (71.345625ms)

2024-01-26 14:34:19.679 [INF] TADB: 6/u addr_event (92.739ms)

2024-01-26 14:34:19.699 [INF] TADB: 7/u universe (112.860083ms)

2024-01-26 14:34:19.719 [INF] TADB: 8/u universe_events_timestamp (132.720083ms)

2024-01-26 14:34:19.738 [INF] TADB: 9/u universe_configs (151.378458ms)

2024-01-26 14:34:19.756 [INF] TADB: 10/u universe_stats (170.026667ms)

2024-01-26 14:34:19.777 [INF] TADB: 11/u transfers (190.396541ms)

2024-01-26 14:34:19.787 [INF] TADB: Applying migrations from version=11
2024-01-26 14:34:19.806 [INF] TADB: 12/u anchor_txid (19.100541ms)

2024-01-26 14:34:19.836 [INF] TADB: 13/u universe_fed_proof_sync_log (48.872875ms)

2024-01-26 14:34:19.853 [INF] TADB: 14/u multiverse_tree (65.75275ms)

In this commit, we add support for logging migrations as they happen.
This is useful for users to keep track of what happens during a `tapd`
update.
@Roasbeef
Copy link
Member Author

Fixed to remove the trailing new lines:

=== RUN   TestMigrationSteps
    test_sqlite.go:23: Creating new SQLite DB for testing, migrating to version 1
2024-01-26 14:37:12.056 [INF] TADB: Applying migrations from version=0
2024-01-26 14:37:12.072 [INF] TADB: 1/u macaroons (16.111792ms)
2024-01-26 14:37:12.073 [INF] TADB: Applying migrations from version=1
2024-01-26 14:37:12.091 [INF] TADB: 2/u assets (18.290917ms)
2024-01-26 14:37:12.108 [INF] TADB: 3/u addrs (34.833542ms)
2024-01-26 14:37:12.126 [INF] TADB: 4/u mssmt (52.69575ms)
2024-01-26 14:37:12.143 [INF] TADB: 5/u transfers (70.402167ms)
2024-01-26 14:37:12.161 [INF] TADB: 6/u addr_event (88.234833ms)
2024-01-26 14:37:12.182 [INF] TADB: 7/u universe (108.87ms)
2024-01-26 14:37:12.201 [INF] TADB: 8/u universe_events_timestamp (127.6985ms)
2024-01-26 14:37:12.220 [INF] TADB: 9/u universe_configs (146.415166ms)
2024-01-26 14:37:12.237 [INF] TADB: 10/u universe_stats (164.199ms)
2024-01-26 14:37:12.257 [INF] TADB: 11/u transfers (183.851917ms)
2024-01-26 14:37:12.269 [INF] TADB: Applying migrations from version=11
2024-01-26 14:37:12.302 [INF] TADB: 12/u anchor_txid (33.000167ms)
2024-01-26 14:37:12.320 [INF] TADB: 13/u universe_fed_proof_sync_log (50.443666ms)
2024-01-26 14:37:12.340 [INF] TADB: 14/u multiverse_tree (70.45ms)
--- PASS: TestMigrationSteps (0.32s)

@jharveyb jharveyb self-requested a review January 26, 2024 22:42
Copy link
Contributor

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

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

LGTM 💯

@Roasbeef Roasbeef merged commit cd916e7 into main Jan 26, 2024
14 checks passed
@guggero guggero deleted the log-migration branch March 4, 2024 15:39
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.

2 participants