diff --git a/.github/workflows/external-raft.yml b/.github/workflows/external-raft.yml deleted file mode 100644 index da23836f8..000000000 --- a/.github/workflows/external-raft.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: CI Tests (external libraft) - -on: - - push - - pull_request - -jobs: - build-and-test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup dependencies - run: | - sudo apt update - sudo apt install -y libsqlite3-dev liblz4-dev libuv1-dev - - - name: Build raft - run: | - git clone https://github.com/canonical/raft --depth 1 - cd raft - autoreconf -i - ./configure --enable-debug --enable-sanitize - make -j4 - sudo make install - sudo ldconfig - - - name: Build dqlite - run: | - autoreconf -i - ./configure --enable-debug --enable-sanitize - make -j4 - - - name: Test - run: | - export LIBRAFT_TRACE=1 LIBDQLITE_TRACE=1 - make -j4 check || (cat ./test-suite.log && false) diff --git a/Makefile.am b/Makefile.am index 4b4985d7e..bbfd36114 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,11 +13,6 @@ endif AM_LDFLAGS = $(static) AM_LDFLAGS += $(UV_LIBS) $(PTHREAD_LIBS) -if !BUILD_RAFT_ENABLED -AM_CFLAGS += $(RAFT_CFLAGS) -DUSE_SYSTEM_RAFT -AM_LDFLAGS += $(RAFT_LIBS) -endif - if DEBUG_ENABLED AM_CFLAGS += -O0 else @@ -77,7 +72,6 @@ libdqlite_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden -DRAFT_API='' libdqlite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:1:0 libdqlite_la_SOURCES = $(basic_dqlite_sources) -if BUILD_RAFT_ENABLED libraft_la_SOURCES = \ src/raft/byte.c \ src/raft/callbacks.c \ @@ -131,7 +125,6 @@ libraft_la_SOURCES = \ src/raft/uv_writer.c libdqlite_la_SOURCES += $(libraft_la_SOURCES) -endif # BUILD_RAFT_ENABLED check_PROGRAMS = unit-test integration-test @@ -179,9 +172,7 @@ unit_test_CFLAGS = $(AM_CFLAGS) -Wno-unknown-warning-option -Wno-uninitialized - unit_test_LDFLAGS = $(AM_LDFLAGS) unit_test_LDADD = libtest.la -if BUILD_RAFT_ENABLED unit_test_LDADD += libraft.la -endif integration_test_SOURCES = \ test/integration/test_client.c \ @@ -197,7 +188,6 @@ integration_test_CFLAGS = $(AM_CFLAGS) -Wno-conversion integration_test_LDFLAGS = $(AM_LDFLAGS) -no-install integration_test_LDADD = libtest.la libdqlite.la -if BUILD_RAFT_ENABLED check_LTLIBRARIES += libraft.la check_PROGRAMS += \ @@ -341,8 +331,6 @@ raft_core_unit_test_CFLAGS += -DLZ4_ENABLED libraft_la_CFLAGS += -DLZ4_ENABLED endif -endif # BUILD_RAFT_ENABLED - if BUILD_SQLITE_ENABLED noinst_LTLIBRARIES = libsqlite3.la libsqlite3_la_SOURCES = sqlite3.c diff --git a/configure.ac b/configure.ac index 2c281eea9..50bf8b61e 100644 --- a/configure.ac +++ b/configure.ac @@ -35,8 +35,14 @@ AM_CONDITIONAL(BACKTRACE_ENABLED, test "x$enable_backtrace" = "xyes") AC_ARG_ENABLE(build-sqlite, AS_HELP_STRING([--enable-build-sqlite[=ARG]], [build libsqlite3 from sqlite3.c in the build root [default=no]])) AM_CONDITIONAL(BUILD_SQLITE_ENABLED, test "x$enable_build_sqlite" = "xyes") -AC_ARG_ENABLE(build-raft, AS_HELP_STRING([--enable-build-raft[=ARG]], [use the bundled raft sources instead of linking to libraft [default=no]])) -AM_CONDITIONAL(BUILD_RAFT_ENABLED, test "x$enable_build_raft" = "xyes") +AC_ARG_ENABLE([build-raft], + [AS_HELP_STRING([--enable-build-raft[=ARG]], + [use the bundled raft sources instead of linking libraft (default is yes, required)])], + [enable_build_raft=$enableval], + [enable_build_raft=yes]) +AS_IF([test "x$enable_build_raft" != "xyes"], + AC_MSG_ERROR([linking to a separately-built libraft is no longer supported]), + []) AC_ARG_WITH(static-deps, AS_HELP_STRING([--with-static-deps[=ARG]], @@ -60,24 +66,15 @@ AC_SYS_LARGEFILE # Checks for libraries PKG_CHECK_MODULES(SQLITE, [sqlite3 >= 3.22.0], [], []) PKG_CHECK_MODULES(UV, [libuv >= 1.34.0], [], []) -AS_IF([test "x$enable_build_raft" != "xyes"], [PKG_CHECK_MODULES(RAFT, [raft >= 0.18.1], [], [])], []) - # Allow not linking to liblz4 even if it's present. AC_ARG_WITH([lz4], AS_HELP_STRING([--without-lz4], [never link to liblz4])) -AS_IF([test "x$enable_build_raft" = "xyes"], - # Building raft - [AS_IF([test "x$with_lz4" != "xno"], - [PKG_CHECK_MODULES(LZ4, [liblz4 >= 1.7.1], [have_lz4=yes], [have_lz4=no])], - [have_lz4=no]) - AS_IF([test "x$with_lz4" = "xyes" -a "x$have_lz4" = "xno"], - [AC_MSG_ERROR([liblz4 required but not found])], - [])], - # Not building raft - [AS_IF([test "x$with_lz4" = "xyes"], - [AC_MSG_ERROR([linking lz4 doesn't make sense unless building raft])], - []) - have_lz4=no]) +AS_IF([test "x$with_lz4" != "xno"], + [PKG_CHECK_MODULES(LZ4, [liblz4 >= 1.7.1], [have_lz4=yes], [have_lz4=no])], + [have_lz4=no]) +AS_IF([test "x$with_lz4" = "xyes" -a "x$have_lz4" = "xno"], + [AC_MSG_ERROR([liblz4 required but not found])], + []) AM_CONDITIONAL(LZ4_AVAILABLE, test "x$have_lz4" = "xyes") diff --git a/src/raft.h b/src/raft.h index 8d0156689..a7c3fe01b 100644 --- a/src/raft.h +++ b/src/raft.h @@ -1,11 +1,4 @@ -#if defined(USE_SYSTEM_RAFT) - -#include -#include -#include - -#elif !defined(RAFT_H) - +#ifndef RAFT_H #define RAFT_H #include diff --git a/src/server.c b/src/server.c index f8f1127f3..26e5bf3a9 100644 --- a/src/server.c +++ b/src/server.c @@ -1064,15 +1064,8 @@ int dqlite_node_describe_last_entry(dqlite_node *n, raft_term *t = (raft_term *)term; int rv; -#ifdef USE_SYSTEM_RAFT - (void)i; - (void)t; - (void)rv; - return DQLITE_ERROR; -#else rv = raft_io_describe_last_entry(&n->raft_io, i, t); return rv == 0 ? 0 : DQLITE_ERROR; -#endif } dqlite_node_id dqlite_generate_node_id(const char *address) diff --git a/test/integration/test_cluster.c b/test/integration/test_cluster.c index 131be5132..ea8f9d6bb 100644 --- a/test/integration/test_cluster.c +++ b/test/integration/test_cluster.c @@ -134,6 +134,7 @@ TEST(cluster, dataOnNewNode, setUp, tearDown, 0, cluster_params) strtol(munit_parameters_get(params, "num_records"), NULL, 0); unsigned id = 2; const char *address = "@2"; + int rv; HANDSHAKE; OPEN; @@ -159,8 +160,6 @@ TEST(cluster, dataOnNewNode, setUp, tearDown, 0, cluster_params) struct test_server *first = &f->servers[0]; test_server_stop(first); test_server_prepare(first, params); -#ifndef USE_SYSTEM_RAFT - int rv; /* One entry per INSERT, plus one for the initial configuration, plus * one for the CREATE TABLE, plus one legacy checkpoint command entry * after 993 records or two after 2200 records. */ @@ -179,7 +178,6 @@ TEST(cluster, dataOnNewNode, setUp, tearDown, 0, cluster_params) munit_assert_uint64(expected_entries, <=, last_entry_index); munit_assert_uint64(last_entry_index, <, expected_entries + max_barriers); munit_assert_uint64(last_entry_term, ==, 1); -#endif test_server_run(first); /* The full table is visible from the new node */ @@ -199,7 +197,6 @@ TEST(cluster, dataOnNewNode, setUp, tearDown, 0, cluster_params) struct test_server *second = &f->servers[1]; test_server_stop(second); test_server_prepare(second, params); -#ifndef USE_SYSTEM_RAFT rv = dqlite_node_describe_last_entry(second->dqlite, &last_entry_index, &last_entry_term); @@ -207,7 +204,6 @@ TEST(cluster, dataOnNewNode, setUp, tearDown, 0, cluster_params) munit_assert_uint64(expected_entries + 1, <=, last_entry_index); munit_assert_uint64(last_entry_index, <, expected_entries + max_barriers + 1); munit_assert_uint64(last_entry_term, ==, 1); -#endif test_server_run(second); return MUNIT_OK; } @@ -332,8 +328,6 @@ TEST(cluster, modifyingQuerySql, setUp, tearDown, 0, cluster_params) return MUNIT_OK; } -#ifndef USE_SYSTEM_RAFT - /* Edge cases for dqlite_node_describe_last_entry. */ TEST(cluster, last_entry_edge_cases, setUp, tearDown, 0, NULL) { @@ -368,5 +362,3 @@ TEST(cluster, last_entry_edge_cases, setUp, tearDown, 0, NULL) return MUNIT_OK; } - -#endif