canonical / dqlite

Embeddable, replicated and fault-tolerant SQL engine.
https://dqlite.io
Other
3.85k stars 216 forks source link

Remove DQLITE_NEXT guard and unify with disk mode #671

Closed cole-miller closed 2 weeks ago

cole-miller commented 2 months ago

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 cole.miller@canonical.com

codecov[bot] commented 2 months ago

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 :warning:
test/raft/integration/test_uv_load.c 83.33% 6 Missing :warning:
src/raft/uv.c 72.72% 2 Missing and 1 partial :warning:
src/raft/uv_metadata.c 84.61% 0 Missing and 2 partials :warning:
src/raft/uv_segment.c 92.30% 0 Missing and 2 partials :warning:
src/raft/uv_encoding.c 90.00% 0 Missing and 1 partial :warning:
src/raft/uv_snapshot.c 50.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cole-miller commented 2 months ago

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.