Skip to content

Conversation

@kstepanovdev
Copy link
Contributor

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.

@kstepanovdev kstepanovdev self-assigned this Oct 24, 2024
@kstepanovdev kstepanovdev requested a review from n00m4d October 24, 2024 13:03
(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 {
Copy link
Contributor

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

Copy link
Contributor Author

@kstepanovdev kstepanovdev Oct 28, 2024

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?

Copy link
Contributor

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


let rocks_storage = Arc::new(storage);
let secondary_storage_second_path = config
.rocks_db_secondary_path_container
Copy link
Contributor

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

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.

3 participants