-
Notifications
You must be signed in to change notification settings - Fork 5
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
[MTG-777] Switching between storage instances #295
base: main
Are you sure you want to change the base?
Conversation
nft_ingester/src/rocks_db.rs
Outdated
(duplicate_mode.current_rocks_db.load(Ordering::Relaxed) + 1) % 2; | ||
let free_node = &duplicate_mode.rocks_db_instance[free_node_idx]; | ||
|
||
while Arc::<rocks_db::Storage>::strong_count(&free_node) > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also pass shutdown_rx here? we do not need to catch up DB when stop signal is sent to app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch_up
will be fired only if clone_rx (main:229) is empty. Isn't it sufficient?
Or do you want to prevent the situation, when we continue catching up when received the shutdown_rx while waiting for Arcs to clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap, the comment is about a situation you described
nft_ingester/src/bin/api/main.rs
Outdated
mutexed_tasks.clone(), | ||
red_metrics.clone(), | ||
MigrationState::Last, | ||
) | ||
.unwrap(); | ||
|
||
let rocks_storage = Arc::new(storage); | ||
let secondary_storage_second_path = config | ||
.rocks_db_secondary_path_container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use another env. Now you are using config.rocks_db_secondary_path_container
for both secondary_storage_second_path
and secondary_storage_first_path
but they must be different
The new enum
RocksDbManager
is provided.Its purpose is to leave the behavior of RocksDb primary mode as it was while providing an additional feature of switching secondary instances. It means, it means, in theory only one instance will be serving requests while the second will be catching up and vice versa in a perpetual loop.