diff --git a/db/comdb2.c b/db/comdb2.c index c1ee3f5bb0..aa02e6f3f6 100644 --- a/db/comdb2.c +++ b/db/comdb2.c @@ -2275,6 +2275,19 @@ static inline int db_get_alias(void *tran, dbtable *tbl) return 0; } +static void init_static_table(struct dbenv *dbenv) +{ + /* Initialize static table once */ + if (dbenv->static_table.dbs_idx != 0) + return; + /* Initialize static table once */ + logmsg(LOGMSG_INFO, "%s initializing static table '%s'\n", __func__, COMDB2_STATIC_TABLE); + dbenv->static_table.dbs_idx = -1; + dbenv->static_table.tablename = COMDB2_STATIC_TABLE; + dbenv->static_table.dbenv = dbenv; + dbenv->static_table.dbtype = DBTYPE_TAGGED_TABLE; + dbenv->static_table.handle = dbenv->bdb_env; +} /* gets the table names and dbnums from the low level meta table and sets up the * dbenv accordingly. returns 0 on success and anything else otherwise */ @@ -2297,17 +2310,7 @@ static int llmeta_load_tables(struct dbenv *dbenv, void *tran) /* set generic settings, likely already set when env was opened, but make * sure */ bdb_attr_set(dbenv->bdb_attr, BDB_ATTR_GENIDS, 1); - - /* Initialize static table once */ - if (dbenv->static_table.dbs_idx == 0) { - logmsg(LOGMSG_INFO, "%s initializing static table '%s'\n", __func__, - COMDB2_STATIC_TABLE); - dbenv->static_table.dbs_idx = -1; - dbenv->static_table.tablename = COMDB2_STATIC_TABLE; - dbenv->static_table.dbenv = dbenv; - dbenv->static_table.dbtype = DBTYPE_TAGGED_TABLE; - dbenv->static_table.handle = dbenv->bdb_env; - } + init_static_table(dbenv); /* make room for dbs */ dbenv->dbs = realloc(dbenv->dbs, fndnumtbls * sizeof(dbtable *)); @@ -4220,6 +4223,8 @@ static int init(int argc, char **argv) if (gbl_create_mode) { create_service_file(lrlname); + if (!gbl_init_single_meta) + init_static_table(thedb); } /* open db engine */ diff --git a/db/glue.c b/db/glue.c index 3add8fd75d..c8ba0e4f49 100644 --- a/db/glue.c +++ b/db/glue.c @@ -4101,6 +4101,11 @@ int backend_open_tran(struct dbenv *dbenv, tran_type *tran, uint32_t flags) logmsg(LOGMSG_ERROR, "meta database not available\n"); } } + + /* disable these queuedb tunables that require singlemeta */ + gbl_init_with_queue_odh = 0; + gbl_init_with_queue_compr = 0; + gbl_init_with_queue_persistent_seq = 0; } /* now that meta is open, get the blobstripe conversion genids for each diff --git a/tests/queuedb_multimeta.test/Makefile b/tests/queuedb_multimeta.test/Makefile new file mode 100644 index 0000000000..b6cafefe6f --- /dev/null +++ b/tests/queuedb_multimeta.test/Makefile @@ -0,0 +1,5 @@ +ifeq ($(TESTSROOTDIR),) + include ../testcase.mk +else + include $(TESTSROOTDIR)/testcase.mk +endif diff --git a/tests/queuedb_multimeta.test/expected b/tests/queuedb_multimeta.test/expected new file mode 100644 index 0000000000..8427d4a2e2 --- /dev/null +++ b/tests/queuedb_multimeta.test/expected @@ -0,0 +1,9 @@ +[CREATE TABLE t1 (a INTEGER)] rc 0 +(filename='_comdb2_static_table.metalite.dta') +(filename='sqlite_stat1.metalite.dta') +(filename='sqlite_stat4.metalite.dta') +(filename='t1.metalite.dta') +[SELECT DISTINCT filename FROM comdb2_files WHERE filename LIKE '%metalite%'] rc 0 +[CREATE DEFAULT LUA CONSUMER q1 ON (TABLE t1 FOR INSERT)] rc 0 +(name='q1') +[SELECT name FROM comdb2_procedures] rc 0 diff --git a/tests/queuedb_multimeta.test/lrl.options b/tests/queuedb_multimeta.test/lrl.options new file mode 100644 index 0000000000..b7d137bab7 --- /dev/null +++ b/tests/queuedb_multimeta.test/lrl.options @@ -0,0 +1,2 @@ +logmsg level info +singlemeta 0 diff --git a/tests/queuedb_multimeta.test/runit b/tests/queuedb_multimeta.test/runit new file mode 100755 index 0000000000..b29698e71a --- /dev/null +++ b/tests/queuedb_multimeta.test/runit @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +bash -n "$0" | exit 1 +dbnm=$1 + +cdb2sql ${CDB2_OPTIONS} $dbnm default - >actual <