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

Add support for open_as_secondary APIs. #406

Merged
merged 2 commits into from Apr 22, 2020

Conversation

calavera
Copy link
Contributor

@calavera calavera commented Apr 21, 2020

This change adds support for the OpenAsSecondary APIs to open a database
as a secondary. It also adds support for TryCatchUpWithPrimary to allow
clients to synchronize primary and secondary.

/cc @aleksuss

Signed-off-by: David Calavera david.calavera@gmail.com

This change adds support for the OpenAsSecondary APIs to open a database
as a secondary. It also adds support for TryCatchUpWithPrimary to allow
clients to syncronize primary and secondary.

Signed-off-by: David Calavera <david.calavera@gmail.com>
@aleksuss aleksuss self-requested a review Apr 22, 2020
@aleksuss
Copy link
Member

aleksuss commented Apr 22, 2020

Overall looks good. But to be honest I'd like to see some tests for covering this functionality. Could you add a couple ? Thanks.

Include a case to use try_catch_up_with_primary.

Signed-off-by: David Calavera <david.calavera@gmail.com>
@calavera
Copy link
Contributor Author

calavera commented Apr 22, 2020

Overall looks good. But to be honest I'd like to see some tests for covering this functionality. Could you add a couple ? Thanks.

I've added a test @aleksuss, thanks for the reminder! 🙌

Copy link
Member

@aleksuss aleksuss left a comment

LGTM with some nit picks


let result = secondary.get(b"key1");
let vector = result.unwrap().unwrap();
assert!(get_byte_slice(&vector) == b"value1");
Copy link
Member

@aleksuss aleksuss Apr 22, 2020

Choose a reason for hiding this comment

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

Suggested change
assert!(get_byte_slice(&vector) == b"value1");
assert_eq!(get_byte_slice(&vector), b"value1");


let result = secondary.get(b"key1");
let vector = result.unwrap().unwrap();
assert!(get_byte_slice(&vector) == b"value2");
Copy link
Member

@aleksuss aleksuss Apr 22, 2020

Choose a reason for hiding this comment

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

Suggested change
assert!(get_byte_slice(&vector) == b"value2");
assert_eq!(get_byte_slice(&vector), b"value2");

let secondary = DB::open_as_secondary(&opts, &primary_path, &secondary_path).unwrap();

let result = secondary.get(b"key1");
let vector = result.unwrap().unwrap();
Copy link
Member

@aleksuss aleksuss Apr 22, 2020

Choose a reason for hiding this comment

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

This string seems to be redundant. I'd propose like:

let result = secondary.get(b"key1").unwrap().unwrap();

@aleksuss aleksuss merged commit 7105d0d into rust-rocksdb:master Apr 22, 2020
aleksuss pushed a commit to aleksuss/rust-rocksdb that referenced this issue Apr 22, 2020
@calavera calavera deleted the secondary branch Apr 22, 2020
@calavera calavera mentioned this pull request Apr 22, 2020
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.

None yet

2 participants