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

Remove DQLITE_NEXT guard and unify with disk mode #671

Closed
wants to merge 9 commits into from

Conversation

cole-miller
Copy link
Contributor

This PR removes the DQLITE_NEXT build configuration. Code for the new disk mode that was previously guarded by #ifdef DQLITE_NEXT can instead be selected at run time by calling the new dqlite_node_create_v2 function. At the raft level, this is supported by making the "format version" number a dynamic value instead of a compile-time constant and plumbing it around.

Standalone version of the first part of #661, with the relevant review comments addressed (thanks @letFunny).

Signed-off-by: Cole Miller [email protected]

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 85.88235% with 24 lines in your changes missing coverage. Please review.

Project coverage is 77.87%. Comparing base (ee07596) to head (3e7e544).
Report is 100 commits behind head on master.

Files with missing lines Patch % Lines
src/server.c 68.96% 6 Missing and 3 partials ⚠️
test/raft/integration/test_uv_load.c 83.33% 6 Missing ⚠️
src/raft/uv.c 72.72% 2 Missing and 1 partial ⚠️
src/raft/uv_metadata.c 84.61% 0 Missing and 2 partials ⚠️
src/raft/uv_segment.c 92.30% 0 Missing and 2 partials ⚠️
src/raft/uv_encoding.c 90.00% 0 Missing and 1 partial ⚠️
src/raft/uv_snapshot.c 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #671      +/-   ##
==========================================
+ Coverage   77.56%   77.87%   +0.30%     
==========================================
  Files         197      197              
  Lines       27638    27936     +298     
  Branches     5486     5520      +34     
==========================================
+ Hits        21438    21754     +316     
- Misses       4326     4356      +30     
+ Partials     1874     1826      -48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@letFunny letFunny left a comment

Choose a reason for hiding this comment

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

Looking very good Cole! Thanks for creating a different PR for these changes, it was much much easier to review. I left a lot of comments but 90% of them are about using constants :P and the rest are questions that I had.

include/dqlite.h Show resolved Hide resolved
src/raft.h Show resolved Hide resolved
src/raft/uv.c Outdated Show resolved Hide resolved
src/raft/uv.h Outdated Show resolved Hide resolved
src/raft/uv_segment.c Outdated Show resolved Hide resolved
src/server.c Show resolved Hide resolved
test/lib/server.c Outdated Show resolved Hide resolved
test/raft/integration/test_uv_load.c Outdated Show resolved Hide resolved
test/raft/integration/test_uv_load.c Outdated Show resolved Hide resolved
test/raft/integration/test_uv_load.c Outdated Show resolved Hide resolved
This commit removes the DQLITE_NEXT build configuration. Code for the
new disk mode that was previously guarded by `#ifdef DQLITE_NEXT` can
instead be selected at run time by calling the new
`dqlite_node_create_v2` function. At the raft level, this is supported
by making the "format version" number a dynamic value instead of a
compile-time constant and plumbing it around.

Signed-off-by: Cole Miller <[email protected]>
test/lib/util.h Outdated Show resolved Hide resolved
Signed-off-by: Cole Miller <[email protected]>
Signed-off-by: Cole Miller <[email protected]>
This is an experimental interface, but that doesn't mean it's
frictionless to change it: go-dqlite is downstream of us and will have
to be updated if we decide to change the signature. So let's leave some
room to grow by taking a flags bitmask instead of a single bool.

Signed-off-by: Cole Miller <[email protected]>
This lets us avoid breaking the go-dqlite build.

Partially reverts commit 7cf8728.

Signed-off-by: Cole Miller <[email protected]>
@cole-miller cole-miller requested a review from letFunny August 1, 2024 04:27
Copy link
Contributor

@letFunny letFunny left a comment

Choose a reason for hiding this comment

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

Thanks for the changes to the public API, lgtm!

@cole-miller cole-miller requested a review from letFunny August 2, 2024 14:30
@cole-miller
Copy link
Contributor Author

cole-miller commented Aug 2, 2024

As discussed on MM I've pushed commits to remove the flags argument to dqlite_node_create_v2, which now uses disk mode exclusively. dqlite_node_enable_disk_mode remains a no-op. This design removes ambiguity about when to migrate from one interface to another, makes the experimental nature of dqlite_node_create_v2 clearer, and leads to a better story for migrating to dqlite_node_create_v2 and eventually removing support fo removing the in-memory mode.

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