diff --git a/bdb/file.c b/bdb/file.c index ef446c0a79..604567e596 100644 --- a/bdb/file.c +++ b/bdb/file.c @@ -9051,8 +9051,8 @@ static int call_berkdb_pgmv_rtn(bdb_state_type *bdb_state, pgmv_rtn rtn, const c /* Process data and blob */ for (dta = 0; rc == 0 && dta < MAXDTAFILES; ++dta) { - if (blobonly && dta == 0) - continue; + if (blobonly && dta == 0) + continue; for (stripe = 0; rc == 0 && stripe < MAXDTASTRIPE; ++stripe) { if ((dbp = bdb_state->dbp_data[dta][stripe]) != NULL) { rc = rtn(dbp, txn); diff --git a/berkdb/db/db_dispatch.c b/berkdb/db/db_dispatch.c index ea5d92a66b..7514a7f3b6 100644 --- a/berkdb/db/db_dispatch.c +++ b/berkdb/db/db_dispatch.c @@ -315,6 +315,10 @@ ufid_for_recovery_record(DB_ENV *env, DB_LSN *lsn, int rectype, case DB___db_pg_freedata: case DB___db_pg_prepare: case DB___db_pg_new: + case DB___db_rebuild_freelist: + case DB___db_pg_swap: + case DB___db_resize: + case DB___db_pg_swap_overflow: case DB___ham_splitdata: case DB___ham_replace: case DB___ham_copypage: @@ -407,7 +411,7 @@ ufid_for_recovery_record(DB_ENV *env, DB_LSN *lsn, int rectype, * bigger transactions except rowlocks. */ if (rectype < 10000) { - logmsg(LOGMSG_FATAL, "got rectype %d, don't know how to handle it", + logmsg(LOGMSG_FATAL, "got rectype %d, don't know how to handle it\n", rectype); abort(); } diff --git a/berkdb/db/db_pgcompact.c b/berkdb/db/db_pgcompact.c index 52eec7a915..0b90e79fc2 100644 --- a/berkdb/db/db_pgcompact.c +++ b/berkdb/db/db_pgcompact.c @@ -589,6 +589,7 @@ __db_pgswap(dbp, txn) h = ph = nh = pp = np = NULL; got_hl = got_pl = got_nl = got_newl = 0; + stack = 0; lfp = NULL; lpgnofromfl = NULL; diff --git a/berkdb/db/db_rec.c b/berkdb/db/db_rec.c index 000ca51698..96f33dc58d 100644 --- a/berkdb/db/db_rec.c +++ b/berkdb/db/db_rec.c @@ -1959,11 +1959,12 @@ __db_pg_swap_recover(dbenv, dbtp, lsnp, op, info) int ret, t_ret; int check_page = gbl_check_page_in_recovery; + pagep = pp = newp = nextp = prevp = NULL; + hmodified = ppmodified = newmodified = nhmodified = phmodified = 0; + REC_PRINT(__db_pg_swap_print); REC_INTRO(__db_pg_swap_read, 0); - pagep = pp = newp = nextp = prevp = NULL; - if ((ret = __memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { ret = __db_pgerr(file_dbp, argp->pgno, ret); pagep = NULL; @@ -1975,8 +1976,6 @@ __db_pg_swap_recover(dbenv, dbtp, lsnp, op, info) __dir_pg(mpf, argp->pgno, (u_int8_t *)pagep, 1); } - hmodified = ppmodified = newmodified = nhmodified = phmodified = 0; - if (gbl_pgmv_verbose) { logmsg(LOGMSG_WARN, "replacing pgno %u with newp %u before lsn %d:%d, " "page lsn %d:%d, after lsn %d:%d\n", @@ -2243,6 +2242,7 @@ __db_resize_recover(dbenv, dbtp, lsnp, op, info) h = NULL; meta = NULL; + modified = 0; REC_PRINT(__db_resize_print); REC_INTRO(__db_resize_read, 0); @@ -2259,8 +2259,6 @@ __db_resize_recover(dbenv, dbtp, lsnp, op, info) __dir_pg(mpf, argp->meta_pgno, (u_int8_t *)meta, 1); } - modified = 0; - cmp_n = log_compare(lsnp, &LSN(meta)); cmp_p = log_compare(&LSN(meta), &argp->meta_lsn); @@ -2345,12 +2343,12 @@ __db_pg_swap_overflow_recover(dbenv, dbtp, lsnp, op, info) int ret, t_ret; int ohmodified, pohmodified, nohmodified, hmodified, newohmodified; - REC_PRINT(__db_pg_swap_overflow_print); - REC_INTRO(__db_pg_swap_overflow_read, 0); - oh = poh = noh = h = newoh = NULL; ohmodified = pohmodified = nohmodified = hmodified = newohmodified = 0; + REC_PRINT(__db_pg_swap_overflow_print); + REC_INTRO(__db_pg_swap_overflow_read, 0); + if ((ret = __memp_fget(mpf, &argp->pgno, 0, &oh)) != 0) { ret = __db_pgerr(file_dbp, argp->pgno, ret); oh = NULL; diff --git a/berkdb/mp/mp_fput.c b/berkdb/mp/mp_fput.c index f492c48405..6df54d4370 100644 --- a/berkdb/mp/mp_fput.c +++ b/berkdb/mp/mp_fput.c @@ -25,7 +25,7 @@ static const char revid[] = "$Id: mp_fput.c,v 11.48 2003/09/30 17:12:00 sue Exp #include "comdb2_atomic.h" extern int gbl_enable_cache_internal_nodes; -int gbl_memp_fput_abort_on_double_retur; = 0; +int gbl_memp_fput_abort_on_double_return = 0; static void __memp_reset_lru __P((DB_ENV *, REGINFO *)); diff --git a/db/db_tunables.h b/db/db_tunables.h index 110c8feb49..63dd23a332 100644 --- a/db/db_tunables.h +++ b/db/db_tunables.h @@ -2426,27 +2426,23 @@ REGISTER_TUNABLE("sc_status_max_rows", "Max number of rows returned in comdb2_sc TUNABLE_INTEGER, &gbl_sc_status_max_rows, 0, NULL, NULL, NULL, NULL); REGISTER_TUNABLE("rep_process_pstack_time", "pstack the server if rep_process runs longer than time specified in secs (Default: 30s)", TUNABLE_INTEGER, &gbl_rep_process_pstack_time, 0, NULL, NULL, NULL, NULL); -REGISTER_TUNABLE("pgmv_verbose", - "Set to true to print debug trace for pgmv", - TUNABLE_BOOLEAN, &gbl_pgmv_verbose, 0, NULL, NULL, NULL, NULL); +REGISTER_TUNABLE("pgmv_verbose", "Set to true to print debug trace for pgmv", TUNABLE_BOOLEAN, &gbl_pgmv_verbose, 0, + NULL, NULL, NULL, NULL); REGISTER_TUNABLE("pgmv_unsafe_db_resize", - "Set to true to resize a file even if pages may still be referenced in the log", - TUNABLE_BOOLEAN, &gbl_pgmv_unsafe_db_resize, 0, NULL, NULL, NULL, NULL); + "Set to true to resize a file even if pages may still be referenced in the log", TUNABLE_BOOLEAN, + &gbl_pgmv_unsafe_db_resize, 0, NULL, NULL, NULL, NULL); REGISTER_TUNABLE("pgmv_max_num_pages_swapped_per_txn", - "Max number of pages that may be swapped within a single transaction", - TUNABLE_INTEGER, &gbl_pgmv_max_num_pages_swapped_per_txn, 0, NULL, NULL, NULL, NULL); + "Max number of pages that may be swapped within a single transaction", TUNABLE_INTEGER, + &gbl_pgmv_max_num_pages_swapped_per_txn, 0, NULL, NULL, NULL, NULL); REGISTER_TUNABLE("pgmv_only_process_pages_in_bufferpool", - "Set to true to make pgmv only process pages in the bufferpool", - TUNABLE_BOOLEAN, &gbl_pgmv_only_process_pages_in_bufferpool, 0, NULL, NULL, NULL, NULL); -REGISTER_TUNABLE("pgmv_thr", - "Set to true to move pages in background", - TUNABLE_BOOLEAN, &gbl_pgmv_thr, 0, NULL, NULL, NULL, NULL); -REGISTER_TUNABLE("pgmv_thr_run_interval_ms", - "Number of milliseconds we poll for each pgmv iteration", - TUNABLE_INTEGER, &gbl_pgmv_thr_run_interval_ms, 0, NULL, NULL, NULL, NULL); -REGISTER_TUNABLE("pgmv_thr_pause", - "Number of milliseconds we poll for each pgmv iteration", - TUNABLE_INTEGER, &gbl_pgmv_thr_pause, 0, NULL, NULL, NULL, NULL); + "Set to true to make pgmv only process pages in the bufferpool", TUNABLE_BOOLEAN, + &gbl_pgmv_only_process_pages_in_bufferpool, 0, NULL, NULL, NULL, NULL); +REGISTER_TUNABLE("pgmv_thr", "Set to true to move pages in background", TUNABLE_BOOLEAN, &gbl_pgmv_thr, 0, NULL, NULL, + NULL, NULL); +REGISTER_TUNABLE("pgmv_thr_run_interval_ms", "Number of milliseconds we poll for each pgmv iteration", TUNABLE_INTEGER, + &gbl_pgmv_thr_run_interval_ms, 0, NULL, NULL, NULL, NULL); +REGISTER_TUNABLE("pgmv_thr_pause", "Number of milliseconds we poll for each pgmv iteration", TUNABLE_INTEGER, + &gbl_pgmv_thr_pause, 0, NULL, NULL, NULL, NULL); REGISTER_TUNABLE("memp_fput_abort_on_double_return", "Number of milliseconds we poll for each pgmv iteration", TUNABLE_INTEGER, &gbl_memp_fput_abort_on_double_return, 0, NULL, NULL, NULL, NULL); diff --git a/db/glue.c b/db/glue.c index 5355216a6f..f18afb6523 100644 --- a/db/glue.c +++ b/db/glue.c @@ -6331,19 +6331,19 @@ typedef int (*bdb_pgmv_rtn)(bdb_state_type *); static int call_bdb_pgmv_rtn(const char *table, bdb_pgmv_rtn rtn) { int ret; - dbtable *db; + dbtable *db; - if (table == NULL) - return -1; + if (table == NULL) + return -1; - db = get_dbtable_by_name(table); - if (db == NULL) { - logmsg(LOGMSG_ERROR, "%s: table \"%s\" not found", __func__, table); - ret = -1; - } else { - ret = rtn(get_bdb_handle(db, AUXDB_NONE)); - } - return ret; + db = get_dbtable_by_name(table); + if (db == NULL) { + logmsg(LOGMSG_ERROR, "%s: table \"%s\" not found", __func__, table); + ret = -1; + } else { + ret = rtn(get_bdb_handle(db, AUXDB_NONE)); + } + return ret; } int rebuild_freelist(const char *table) @@ -6374,38 +6374,37 @@ void *pgmv_thr(void *unused) { int i; struct dbtable *table; - const char *name; - int remaining; + const char *name; + int remaining; thrman_register(THRTYPE_PGMV); bdb_thread_event(thedb->bdb_env, BDBTHR_EVENT_START_RDWR); - remaining = gbl_pgmv_thr_overflow_run_interval_ms; + remaining = gbl_pgmv_thr_overflow_run_interval_ms; while (!db_is_exiting()) { - if (gbl_pgmv_thr_pause) { + if (gbl_pgmv_thr_pause) { poll(NULL, 0, gbl_pgmv_thr_run_interval_ms); continue; - } + } - rdlock_schema_lk(); - for (i = 0; i != thedb->num_dbs; ++i) { + rdlock_schema_lk(); + for (i = 0; i != thedb->num_dbs; ++i) { table = thedb->dbs[i]; - name = table->tablename; - if (table->dbtype != DBTYPE_TAGGED_TABLE || - strncasecmp(name, "sqlite_", strlen("sqlite_")) == 0 || + name = table->tablename; + if (table->dbtype != DBTYPE_TAGGED_TABLE || strncasecmp(name, "sqlite_", strlen("sqlite_")) == 0 || strncasecmp(name, "comdb2_", strlen("comdb2_")) == 0) { continue; } rebuild_freelist(name); pgswap(name); - if (remaining <= 0) { - pgswap_overflow(name); - remaining = gbl_pgmv_thr_overflow_run_interval_ms; - } - } - unlock_schema_lk(); - poll(NULL, 0, gbl_pgmv_thr_run_interval_ms); - remaining -= gbl_pgmv_thr_run_interval_ms; + if (remaining <= 0) { + pgswap_overflow(name); + remaining = gbl_pgmv_thr_overflow_run_interval_ms; + } + } + unlock_schema_lk(); + poll(NULL, 0, gbl_pgmv_thr_run_interval_ms); + remaining -= gbl_pgmv_thr_run_interval_ms; } bdb_thread_event(thedb->bdb_env, BDBTHR_EVENT_DONE_RDWR); return NULL; diff --git a/db/thrman.c b/db/thrman.c index 94e29e149f..5bf33154d3 100644 --- a/db/thrman.c +++ b/db/thrman.c @@ -464,17 +464,11 @@ static int thrman_check_threads_stopped_ll(void *context) thr_type_counts[self->type]--; if (0 == - thr_type_counts[THRTYPE_OSQL] + thr_type_counts[THRTYPE_APPSOCK] + - thr_type_counts[THRTYPE_APPSOCK_POOL] + - thr_type_counts[THRTYPE_APPSOCK_SQL] + - thr_type_counts[THRTYPE_CONSUMER] + thr_type_counts[THRTYPE_SQL] + - thr_type_counts[THRTYPE_SQLPOOL] + - thr_type_counts[THRTYPE_SQLENGINEPOOL] + - thr_type_counts[THRTYPE_VERIFY] + thr_type_counts[THRTYPE_ANALYZE] + - thr_type_counts[THRTYPE_PURGEBLKSEQ] + - thr_type_counts[THRTYPE_PGLOGS_ASOF] + - thr_type_counts[THRTYPE_TRIGGER] + - thr_type_counts[THRTYPE_PGMV]) + thr_type_counts[THRTYPE_OSQL] + thr_type_counts[THRTYPE_APPSOCK] + thr_type_counts[THRTYPE_APPSOCK_POOL] + + thr_type_counts[THRTYPE_APPSOCK_SQL] + thr_type_counts[THRTYPE_CONSUMER] + thr_type_counts[THRTYPE_SQL] + + thr_type_counts[THRTYPE_SQLPOOL] + thr_type_counts[THRTYPE_SQLENGINEPOOL] + + thr_type_counts[THRTYPE_VERIFY] + thr_type_counts[THRTYPE_ANALYZE] + thr_type_counts[THRTYPE_PURGEBLKSEQ] + + thr_type_counts[THRTYPE_PGLOGS_ASOF] + thr_type_counts[THRTYPE_TRIGGER] + thr_type_counts[THRTYPE_PGMV]) all_gone = 1; /* if we're exiting then we don't want a schema change thread running */