Commit 4adc495d authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:2504] Added range lock escalation success/failure counts to engine status.

git-svn-id: file:///svn/toku/tokudb@19267 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6f94c397
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -455,6 +455,8 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" u_int32_t range_locks_max; /* max total number of range locks */ \n");
printf(" u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ \n");
printf(" u_int32_t range_locks_curr; /* total range locks currently in use */ \n");
printf(" u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ \n");
printf(" u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ \n");
printf(" u_int64_t inserts; /* ydb row insert operations */ \n");
printf(" u_int64_t deletes; /* ydb row delete operations */ \n");
printf(" u_int64_t commits; /* ydb txn commit operations */ \n");
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -96,6 +96,8 @@ typedef struct __toku_engine_status {
u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
......
......@@ -209,25 +209,16 @@ int toku_ltm_close(toku_ltm* mgr) {
return r;
}
int toku_ltm_get_curr_locks(toku_ltm* mgr, u_int32_t* curr_locks) {
int r = ENOSYS;
if (!mgr || !curr_locks) { r = EINVAL; goto cleanup; }
*curr_locks = mgr->curr_locks;
r = 0;
cleanup:
return r;
void
toku_ltm_get_status(toku_ltm* mgr, LTM_STATUS s) {
s->max_locks = mgr->max_locks;
s->max_locks_per_db = mgr->max_locks_per_db;
s->curr_locks = mgr->curr_locks;
s->lock_escalation_successes = mgr->lock_escalation_successes;
s->lock_escalation_failures = mgr->lock_escalation_failures;
}
int toku_ltm_get_max_locks(toku_ltm* mgr, u_int32_t* max_locks) {
int r = ENOSYS;
if (!mgr || !max_locks) { r = EINVAL; goto cleanup; }
*max_locks = mgr->max_locks;
r = 0;
cleanup:
return r;
}
int toku_ltm_get_max_locks_per_db(toku_ltm* mgr, u_int32_t* max_locks) {
int r = ENOSYS;
......@@ -1727,6 +1718,7 @@ static int toku__ltm_do_escalation(toku_ltm* mgr, BOOL* locks_available) {
}
*locks_available = toku__ltm_lock_test_incr(mgr, 0);
#warning 'if this code is ever made real, add accountability counters here'
r = 0;
cleanup:
return r;
......@@ -1742,6 +1734,10 @@ static int toku__lt_do_escalation_per_db(toku_lock_tree* lt, DB* db, BOOL* locks
if (r!=0) { goto cleanup; }
*locks_available = toku__lt_lock_test_incr_per_db(lt, 0);
if (*locks_available)
lt->mgr->lock_escalation_successes++;
else
lt->mgr->lock_escalation_failures++;
r = 0;
cleanup:
toku__lt_clear_comparison_functions(lt);
......
......@@ -133,6 +133,10 @@ struct __toku_ltm {
u_int32_t curr_locks;
/** The maximum number of locks allowed for the db. */
u_int32_t max_locks_per_db;
/** The number of times lock escalation succeeded */
u_int32_t lock_escalation_successes;
/** The number of times lock escalation failed */
u_int32_t lock_escalation_failures;
/** The list of lock trees it manages. */
toku_lth* lth;
/** List of lock-tree DB mappings. Upon a request for a lock tree given
......@@ -505,9 +509,16 @@ int toku_ltm_set_max_locks_per_db(toku_ltm* mgr, u_int32_t max_locks);
- 0 on success.
- EINVAL if any parameter is NULL.
*/
int toku_ltm_get_max_locks(toku_ltm* mgr, u_int32_t* max_locks);
int toku_ltm_get_curr_locks(toku_ltm* mgr, u_int32_t* curr_locks);
typedef struct ltm_status {
uint32_t max_locks;
uint32_t max_locks_per_db;
uint32_t curr_locks;
uint32_t lock_escalation_successes;
uint32_t lock_escalation_failures;
} LTM_STATUS_S, *LTM_STATUS;
void toku_ltm_get_status(toku_ltm* mgr, LTM_STATUS s);
int toku_ltm_get_max_locks_per_db(toku_ltm* mgr, u_int32_t* max_locks);
......
......@@ -1567,9 +1567,13 @@ env_get_engine_status(DB_ENV * env, ENGINE_STATUS * engstat) {
}
{
toku_ltm* ltm = env->i->ltm;
r = toku_ltm_get_max_locks(ltm, &(engstat->range_locks_max)); assert(r==0);
r = toku_ltm_get_max_locks_per_db(ltm, &(engstat->range_locks_max_per_index)); assert(r==0);
r = toku_ltm_get_curr_locks(ltm, &(engstat->range_locks_curr)); assert(r==0);
LTM_STATUS_S ltmstat;
toku_ltm_get_status(ltm, &ltmstat);
engstat->range_locks_max = ltmstat.max_locks;
engstat->range_locks_max_per_index = ltmstat.max_locks_per_db;
engstat->range_locks_curr = ltmstat.curr_locks;
engstat->range_lock_escalation_successes = ltmstat.lock_escalation_successes;
engstat->range_lock_escalation_failures = ltmstat.lock_escalation_failures;
}
{
engstat->inserts = num_inserts;
......@@ -1655,6 +1659,8 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) {
n += snprintf(buff + n, bufsiz - n, "range_locks_max %"PRIu32"\n", engstat.range_locks_max);
n += snprintf(buff + n, bufsiz - n, "range_locks_max_per_index %"PRIu32"\n", engstat.range_locks_max_per_index);
n += snprintf(buff + n, bufsiz - n, "range_locks_curr %"PRIu32"\n", engstat.range_locks_curr);
n += snprintf(buff + n, bufsiz - n, "range_locks_escalation_successes %"PRIu32"\n", engstat.range_lock_escalation_successes);
n += snprintf(buff + n, bufsiz - n, "range_locks_escalation_failures %"PRIu32"\n", engstat.range_lock_escalation_failures);
n += snprintf(buff + n, bufsiz - n, "inserts %"PRIu64"\n", engstat.inserts);
n += snprintf(buff + n, bufsiz - n, "deletes %"PRIu64"\n", engstat.deletes);
n += snprintf(buff + n, bufsiz - n, "commits %"PRIu64"\n", engstat.commits);
......
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