Skip to content

Commit

Permalink
Remove experimental zeroskip database backend
Browse files Browse the repository at this point in the history
It never was ready for production use, is not distributed
anymore in cyruslibs and is not developed further.
  • Loading branch information
rsto committed Jan 10, 2025
1 parent ed755c1 commit f9d140a
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 709 deletions.
7 changes: 0 additions & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1512,13 +1512,6 @@ endif
lib_libcyrus_la_LIBADD = libcrc32.la ${LIB_SASL} $(SSL_LIBS) $(GCOV_LIBS) $(LIBM)
lib_libcyrus_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)

if USE_ZEROSKIP
lib_libcyrus_la_SOURCES += lib/cyrusdb_zeroskip.c
lib_libcyrus_la_LIBADD += $(ZEROSKIP_LIBS)
lib_libcyrus_la_CFLAGS += $(ZEROSKIP_CFLAGS)
AM_CPPFLAGS += $(ZEROSKIP_CFLAGS)
endif

noinst_LTLIBRARIES += libcrc32.la
libcrc32_la_SOURCES = lib/crc32.c
libcrc32_la_CFLAGS = -O3 $(AM_CFLAGS) $(CFLAG_VISIBILITY)
Expand Down
7 changes: 3 additions & 4 deletions bench/cyrdbbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static void usage(const char *progname)
printf(" -d, --db the db to run the benchmarks on\n");
printf(" (if not provided, will create a new db)\n");
printf(" -t, --backend type of the db backend to run benchmarks on\n");
printf(" Available Cyrus DB's: twoskip, zeroskip\n");
printf(" Available Cyrus DB's: twoskip\n");
printf(" -n, --numrecs number of records to write[default: 1000]\n");
printf(" -h, --help display this help and exit\n");
}
Expand Down Expand Up @@ -480,12 +480,11 @@ int main(int argc, char *argv[])
goto done;
}

if (strncmp(BACKEND, "twoskip", strlen("twoskip")) == 0 ||
strncmp(BACKEND, "zeroskip", strlen("zeroskip")) == 0) {
if (strncmp(BACKEND, "twoskip", strlen("twoskip")) == 0) {
fprintf(stderr, "Running benchmarks for `%s` backend\n", BACKEND);
} else {
fprintf(stderr, "%s is not a valid CyrusDB backend. ", BACKEND);
fprintf(stderr, "Choose between `twoskip` or `zeroskip`.\n");
fprintf(stderr, "Only `twoskip` is supported.\n");
ret = EXIT_FAILURE;
goto done;
}
Expand Down
14 changes: 14 additions & 0 deletions changes/next/remove-zeroskip
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Description:

Remove experimental zeroskip database backend.


Config changes:

Remove any use of zeroskip as database backend. This backend was experimental
and is broken.


Upgrade instructions:

Reconstruct all databases that used the zeroskip backend.
17 changes: 0 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1491,22 +1491,6 @@ PKG_CHECK_MODULES([ICU], [icu-i18n >= 55 icu-uc >= 55], [
AC_SUBST([ICU_LIBS])
AC_SUBST([ICU_CFLAGS])

dnl
dnl Check for zeroskip library, needed for zeroskip support
dnl
AC_ARG_WITH([zeroskip],
[AS_HELP_STRING([--without-zeroskip], [ignore presence of Zeroskip and disable it])],
[],
[with_zeroskip=yes])
AS_IF([test "x$with_zeroskip" = "xyes"],
[ PKG_CHECK_MODULES([ZEROSKIP], [libzeroskip],
[ AC_DEFINE(HAVE_ZEROSKIP, [], [Do we have Zeroskip?])
with_zeroskip=yes ],
with_zeroskip=no)])
AC_SUBST([ZEROSKIP_LIBS])
AC_SUBST([ZEROSKIP_CFLAGS])
AM_CONDITIONAL([USE_ZEROSKIP], [test "x$with_zeroskip" = xyes])

dnl
dnl Check for chardet library, needed for charset detection support
dnl
Expand Down Expand Up @@ -2632,7 +2616,6 @@ Database support:
mysql: $with_mysql
postgresql: $use_pgsql
sqlite: $use_sqlite
zeroskip: $with_zeroskip

Search engine:
squat: $enable_squat
Expand Down
49 changes: 2 additions & 47 deletions cunit/aaa-db.testc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct binary_result
size_t datalen;
};

static const char *backend = CUNIT_PARAM("skiplist,flat,twoskip,zeroskip");
static const char *backend = CUNIT_PARAM("skiplist,flat,twoskip");
static char *filename;
static char *filename2;

Expand Down Expand Up @@ -188,27 +188,11 @@ static char *make_basedir(const char * const *reldirs)
free(actual); \
}

static int skiptest()
{
/* cunit.pl doesn't play nice with #ifdef'ed CUNIT_PARAMS */

if (!strcmp(backend, "zeroskip")) {
#ifdef HAVE_ZEROSKIP
return 0;
#else
return 1;
#endif
}
return 0;
}

static void test_openclose(void)
{
struct db *db = NULL;
int r;

if (skiptest()) return;

CU_ASSERT_EQUAL(fexists(filename), -ENOENT);

/* open() without _CREATE fails with NOTFOUND
Expand Down Expand Up @@ -245,8 +229,6 @@ static void test_multiopen(void)
static const char KEY3[] = "leggings";
static const char DATA3[] = "tumblr salvia";

if (skiptest()) return;

CU_ASSERT_EQUAL(fexists(filename), -ENOENT);

/* open() with _CREATE succeeds and creates the db */
Expand Down Expand Up @@ -335,8 +317,6 @@ static void test_opentwo(void)
struct db *db2 = NULL;
int r;

if (skiptest()) return;

CU_ASSERT_EQUAL(fexists(filename), -ENOENT);
CU_ASSERT_EQUAL(fexists(filename2), -ENOENT);

Expand Down Expand Up @@ -376,8 +356,6 @@ static void test_readwrite(void)
static const char DATA[] = "dem bones dem bones dem thighbones";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -423,8 +401,6 @@ static void test_multirw(void)
static const char DATA2[] = "Dem KneeBones";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -479,8 +455,6 @@ static void test_readwrite_zerolen(void)
static const char DATA[] = "";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -528,8 +502,6 @@ static void test_readwrite_null(void)
static const char EMPTY[] = "";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -575,8 +547,6 @@ static void test_abort(void)
static const char DATA[] = "stanford mit harvard";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -629,8 +599,6 @@ static void test_delete(void)
static const char DATA3[] = "flax corm naipaul enable herrera fating";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -752,8 +720,6 @@ static void test_mboxlist(void)
static const char DATA3[] = "aleut stoic muscovy adonis moe docent";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -815,8 +781,6 @@ static void test_foreach(void)
static const char DATA3[] = "aleut stoic muscovy adonis moe docent";
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -1029,8 +993,6 @@ static void test_foreach_changes(void)
static const char DATA6[] = "annoying push security plenty ending";
int r;

if (skiptest()) return;

if (!strcmp(backend, "flat")) return; /* flat concurrency is bogus */

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
Expand Down Expand Up @@ -1127,8 +1089,6 @@ static void test_binary_keys(void)
struct binary_result *results = NULL;
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -1244,8 +1204,6 @@ static void test_binary_data(void)
struct binary_result *results = NULL;
int r;

if (skiptest()) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
CU_ASSERT_PTR_NOT_NULL(db);
Expand Down Expand Up @@ -1478,8 +1436,6 @@ static void test_many(void)
unsigned int n;
int r;

if (skiptest()) return;

construct_hash_table(&exphash, (MAXN+1)*4, 0);

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
Expand Down Expand Up @@ -1621,8 +1577,7 @@ static void test_foreach_replace(void)
struct txn *txn = NULL;
struct replace_data data;

if (skiptest() || !strcmp(backend, "flat"))
return;
if (!strcmp(backend, "flat")) return;

r = cyrusdb_open(backend, filename, CYRUSDB_CREATE, &db);
CU_ASSERT_EQUAL(r, CYRUSDB_OK);
Expand Down
4 changes: 0 additions & 4 deletions cunit/conversations.testc
Original file line number Diff line number Diff line change
Expand Up @@ -1419,11 +1419,7 @@ static int set_up(void)
);

cyrusdb_init();
#ifdef HAVE_ZEROSKIP
config_conversations_db = "zeroskip";
#else
config_conversations_db = "twoskip";
#endif

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions cunit/libconfig.testc
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ static void test_deprecated_string(void)
static void test_deprecated_stringlist(void)
{
/* { "tlscache_db", "twoskip",
* STRINGLIST("skiplist", "sql", "twoskip", "zeroskip"),
* STRINGLIST("skiplist", "sql", "twoskip"),
* "2.5.0", "tls_sessions_db" }
*/
const char *val;
Expand Down Expand Up @@ -1000,14 +1000,14 @@ static void test_deprecated_stringlist(void)
config_read_string(
"configdirectory: "DBDIR"/conf\n"
"tlscache_db: sql\n"
"tls_sessions_db: zeroskip\n"
"tls_sessions_db: twoskip\n"
);
CU_ASSERT_SYSLOG(/*all*/0, 1);

/* should read new value at the new name */
val = config_getstring(IMAPOPT_TLS_SESSIONS_DB);
CU_ASSERT_PTR_NOT_NULL(val);
CU_ASSERT_STRING_EQUAL(val, "zeroskip");
CU_ASSERT_STRING_EQUAL(val, "twoskip");
}

static void test_deprecated_duration(void)
Expand Down
2 changes: 1 addition & 1 deletion docsrc/imap/concepts/deployment/databases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ This is either cyrus.squat in each folder, or if you're using Xapian a single
<userid>.xapianactive file listing active databases with tier name and number.

cyrus.indexed.db is used by the Xapian search engine. Its file type
can be: `twoskip`_ (default), `flat`_, `skiplist`_, or ``zeroskip`` and is
can be: `twoskip`_ (default), `flat`_, or `skiplist`_ and is
determined by `search_indexed_db` in :cyrusman:`imapd.conf(5)`.

The xapianactive file contains a space separated list of tiers and databases within
Expand Down
4 changes: 0 additions & 4 deletions lib/cyrusdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ extern struct cyrusdb_backend cyrusdb_skiplist;
extern struct cyrusdb_backend cyrusdb_quotalegacy;
extern struct cyrusdb_backend cyrusdb_sql;
extern struct cyrusdb_backend cyrusdb_twoskip;
extern struct cyrusdb_backend cyrusdb_zeroskip;

static struct cyrusdb_backend *_backends[] = {
&cyrusdb_flat,
Expand All @@ -82,9 +81,6 @@ static struct cyrusdb_backend *_backends[] = {
&cyrusdb_sql,
#endif
&cyrusdb_twoskip,
#if defined HAVE_ZEROSKIP
&cyrusdb_zeroskip,
#endif
NULL };

#define DEFAULT_BACKEND "twoskip"
Expand Down
Loading

0 comments on commit f9d140a

Please sign in to comment.