Commit 722bd044 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:2892] Improve upgrade footprint/status.

git-svn-id: file:///svn/toku/tokudb@25770 c7de825b-a66e-492c-adef-691d508d4ae1
parent ef3dc584
......@@ -174,6 +174,7 @@ toku_maybe_upgrade_log(const char *env_dir, const char *log_dir, LSN * lsn_of_cl
int lockfd = -1;
FOOTPRINTSETUP(100000);
footprint = 0;
*upgrade_in_progress = FALSE; // set TRUE only if all criteria are met and we're actually doing an upgrade
FOOTPRINT(1);
......
......@@ -462,10 +462,11 @@ db_use_builtin_key_cmp(DB *db) {
// Following keys added in version 12
static const char * orig_env_ver_key = "original_version";
static const char * curr_env_ver_key = "current_version";
// Following keys added in version 13
// Following keys added in version 13, add more keys for future versions
static const char * creation_time_key = "creation_time";
static const char * last_lsn_of_v12_key = "last_lsn_of_v12";
static const char * upgrade_v13_time_key = "upgrade_v13_time"; // Add more keys for future upgrades
static const char * upgrade_v13_time_key = "upgrade_v13_time";
static const char * upgrade_v13_footprint_key = "upgrade_v13_footprint";
// Values read from (or written into) persistent environment,
// kept here for read-only access from engine status.
......@@ -474,6 +475,7 @@ static uint32_t persistent_stored_env_version_at_startup; // read from curr_e
static time_t persistent_creation_time;
static uint64_t persistent_last_lsn_of_v12;
static time_t persistent_upgrade_v13_time;
static uint64_t persistent_upgrade_v13_footprint;
// Requires: persistent environment dictionary is already open.
// Input arg is lsn of clean shutdown of previous version,
......@@ -512,6 +514,12 @@ maybe_upgrade_persistent_environment_dictionary(DB_ENV * env, DB_TXN * txn, LSN
toku_fill_dbt(&val, &upgrade_v13_time_d, sizeof(upgrade_v13_time_d));
r = toku_db_put(persistent_environment, txn, &key, &val, DB_NOOVERWRITE);
assert(r==0);
uint64_t upgrade_v13_footprint_d = toku_htod64(toku_log_upgrade_get_footprint());
toku_fill_dbt(&key, upgrade_v13_footprint_key, strlen(upgrade_v13_footprint_key));
toku_fill_dbt(&val, &upgrade_v13_footprint_d, sizeof(upgrade_v13_footprint_d));
r = toku_db_put(persistent_environment, txn, &key, &val, DB_NOOVERWRITE);
assert(r==0);
}
return r;
}
......@@ -561,6 +569,12 @@ capture_persistent_env_contents (DB_ENV * env, DB_TXN * txn) {
r = toku_db_get(persistent_environment, txn, &key, &val, 0);
assert(r == 0);
persistent_upgrade_v13_time = toku_dtoh64((*(time_t*)val.data));
toku_fill_dbt(&key, upgrade_v13_footprint_key, strlen(upgrade_v13_footprint_key));
toku_init_dbt(&val);
r = toku_db_get(persistent_environment, txn, &key, &val, 0);
assert(r == 0);
persistent_upgrade_v13_footprint = toku_dtoh64((*(uint64_t*)val.data));
}
}
......@@ -1871,8 +1885,14 @@ env_get_engine_status(DB_ENV * env, ENGINE_STATUS * engstat, char * env_panic_st
{
BRT_UPGRADE_STATUS_S brt_upgrade_stat;
toku_brt_get_upgrade_status(&brt_upgrade_stat);
engstat->upgrade_env_status = toku_log_upgrade_get_footprint();
uint64_t upgrade_footprint = toku_log_upgrade_get_footprint();
// Footprint of upgrade maybe performed for this time environment is opened
// is provided in six least significant decimal digits, footprint of
// upgrade performed when environment was actually upgraded is provided
// in most significant decimal digits.
// If ver_at_startup == 12, then the footprint will have the same value in
// upper and lower digits.
engstat->upgrade_env_status = (persistent_upgrade_v13_footprint * 1000000) + upgrade_footprint;
engstat->upgrade_header = brt_upgrade_stat.header_12;
engstat->upgrade_nonleaf = brt_upgrade_stat.nonleaf_12;
engstat->upgrade_leaf = brt_upgrade_stat.leaf_12;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment