Commit 8ad093a1 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4258], address cr comments from 12/9 meeting

git-svn-id: file:///svn/toku/tokudb@37787 c7de825b-a66e-492c-adef-691d508d4ae1
parent 25eda60f
......@@ -43,11 +43,11 @@ typedef struct blocknum_s { int64_t b; } BLOCKNUM; // make a struct so that we w
static inline BLOCKNUM make_blocknum(int64_t b) { BLOCKNUM result={b}; return result; }
typedef struct pair_attr_s {
long size;
long nonleaf_size;
long leaf_size;
long rollback_size;
long cache_pressure_size;
long size; // size PAIR's value takes in memory
long nonleaf_size; // size if PAIR is a nonleaf node, 0 otherwise
long leaf_size; // size if PAIR is a leaf node, 0 otherwise
long rollback_size; // size of PAIR is a rollback node, 0 otherwise
long cache_pressure_size; // amount PAIR contributes to cache pressure, is sum of buffer sizes and workdone counts
} PAIR_ATTR;
static inline PAIR_ATTR make_pair_attr(long size) {
......
......@@ -1251,7 +1251,7 @@ static void cachetable_maybe_remove_and_free_pair (CACHETABLE ct, PAIR p, BOOL*
}
// Read a pair from a cachefile into memory using the pair's fetch callback
static int cachetable_fetch_pair(
static void cachetable_fetch_pair(
CACHETABLE ct,
CACHEFILE cf,
PAIR p,
......@@ -1274,8 +1274,8 @@ static int cachetable_fetch_pair(
cachetable_unlock(ct);
int r;
if (toku_cachefile_is_dev_null_unlocked(cf)) r = -1;
else r = fetch_callback(cf, cf->fd, key, fullhash, &toku_value, &attr, &dirty, read_extraargs);
assert(!toku_cachefile_is_dev_null_unlocked(cf));
r = fetch_callback(cf, cf->fd, key, fullhash, &toku_value, &attr, &dirty, read_extraargs);
if (dirty)
p->dirty = CACHETABLE_DIRTY;
......@@ -1292,13 +1292,11 @@ static int cachetable_fetch_pair(
if (p->cq) {
workitem_init(&p->asyncwork, NULL, p);
workqueue_enq(p->cq, &p->asyncwork, 1);
return 0;
}
p->state = CTPAIR_IDLE;
nb_mutex_write_unlock(&p->nb_mutex);
if (0) printf("%s:%d %"PRId64" complete\n", __FUNCTION__, __LINE__, key.b);
return 0;
}
static void cachetable_complete_write_pair (CACHETABLE ct, PAIR p, BOOL do_remove, BOOL* destroyed);
......@@ -2125,8 +2123,7 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
nb_mutex_write_lock(&p->nb_mutex, ct->mutex);
uint64_t t0 = get_tnow();
r = cachetable_fetch_pair(ct, cachefile, p, fetch_callback, read_extraargs);
assert(r==0);
cachetable_fetch_pair(ct, cachefile, p, fetch_callback, read_extraargs);
cachetable_miss++;
cachetable_misstime += get_tnow() - t0;
nb_mutex_write_lock(&p->nb_mutex, ct->mutex);
......@@ -2439,13 +2436,12 @@ int toku_cachetable_get_and_pin_nonblocking (
run_unlockers(unlockers); // we hold the ct mutex.
if (ct->ydb_unlock_callback) ct->ydb_unlock_callback();
u_int64_t t0 = get_tnow();
int r = cachetable_fetch_pair(ct, cf, p, fetch_callback, read_extraargs);
cachetable_fetch_pair(ct, cf, p, fetch_callback, read_extraargs);
cachetable_miss++;
cachetable_misstime += get_tnow() - t0;
cachetable_unlock(ct);
if (ct->ydb_lock_callback) ct->ydb_lock_callback();
if (r!=0) return r;
else return TOKUDB_TRY_AGAIN;
return TOKUDB_TRY_AGAIN;
}
struct cachefile_prefetch_args {
......
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