Commit d36e5078 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4302], start fix by changing maybe_flush_some to be a void function and not return an int

git-svn-id: file:///svn/toku/tokudb@37971 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8c451d2a
...@@ -125,7 +125,7 @@ static PAIR_ATTR const zero_attr = { ...@@ -125,7 +125,7 @@ static PAIR_ATTR const zero_attr = {
.cache_pressure_size = 0 .cache_pressure_size = 0
}; };
static int maybe_flush_some (CACHETABLE ct, long size); static void maybe_flush_some (CACHETABLE ct, long size);
static inline void static inline void
ctpair_add_ref(PAIR p) { ctpair_add_ref(PAIR p) {
...@@ -442,13 +442,7 @@ u_int64_t toku_cachetable_reserve_memory(CACHETABLE ct, double fraction) { ...@@ -442,13 +442,7 @@ u_int64_t toku_cachetable_reserve_memory(CACHETABLE ct, double fraction) {
cachetable_wait_write(ct); cachetable_wait_write(ct);
uint64_t reserved_memory = fraction*(ct->size_limit-ct->size_reserved); uint64_t reserved_memory = fraction*(ct->size_limit-ct->size_reserved);
ct->size_reserved += reserved_memory; ct->size_reserved += reserved_memory;
{ maybe_flush_some(ct, reserved_memory);
int r = maybe_flush_some(ct, reserved_memory);
if (r) {
cachetable_unlock(ct);
return r;
}
}
ct->size_current += reserved_memory; ct->size_current += reserved_memory;
cachetable_unlock(ct); cachetable_unlock(ct);
return reserved_memory; return reserved_memory;
...@@ -1530,8 +1524,7 @@ static void cachetable_partial_eviction(WORKITEM wi) { ...@@ -1530,8 +1524,7 @@ static void cachetable_partial_eviction(WORKITEM wi) {
// we are absolutely sure that we will successfully grab it without // we are absolutely sure that we will successfully grab it without
// releasing the cachetable lock // releasing the cachetable lock
// //
static int maybe_flush_some (CACHETABLE ct, long size) { static void maybe_flush_some (CACHETABLE ct, long size) {
int r = 0;
// //
// These variables will help us detect if everything in the clock is currently being accessed. // These variables will help us detect if everything in the clock is currently being accessed.
...@@ -1553,7 +1546,6 @@ static int maybe_flush_some (CACHETABLE ct, long size) { ...@@ -1553,7 +1546,6 @@ static int maybe_flush_some (CACHETABLE ct, long size) {
// we have identified a cycle where everything in the clock is in use // we have identified a cycle where everything in the clock is in use
// do not return an error // do not return an error
// just let memory be overfull // just let memory be overfull
r = 0;
goto exit; goto exit;
} }
else { else {
...@@ -1629,7 +1621,7 @@ static int maybe_flush_some (CACHETABLE ct, long size) { ...@@ -1629,7 +1621,7 @@ static int maybe_flush_some (CACHETABLE ct, long size) {
cachetable_rehash(ct, ct->table_size/2); cachetable_rehash(ct, ct->table_size/2);
} }
exit: exit:
return r; return;
} }
void toku_cachetable_maybe_flush_some(CACHETABLE ct) { void toku_cachetable_maybe_flush_some(CACHETABLE ct) {
...@@ -1741,10 +1733,7 @@ static int cachetable_put_internal( ...@@ -1741,10 +1733,7 @@ static int cachetable_put_internal(
} }
} }
} }
int r; maybe_flush_some(ct, attr.size);
if ((r=maybe_flush_some(ct, attr.size))) {
return r;
}
// flushing could change the table size, but wont' change the fullhash // flushing could change the table size, but wont' change the fullhash
cachetable_puts++; cachetable_puts++;
PAIR p = cachetable_insert_at( PAIR p = cachetable_insert_at(
...@@ -2182,7 +2171,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs ( ...@@ -2182,7 +2171,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
} }
} }
note_hash_count(count); note_hash_count(count);
int r;
// Note. hashit(t,key) may have changed as a result of flushing. But fullhash won't have changed. // Note. hashit(t,key) may have changed as a result of flushing. But fullhash won't have changed.
// The pair was not found, we must retrieve it from disk // The pair was not found, we must retrieve it from disk
{ {
...@@ -2260,10 +2248,10 @@ got_value: ...@@ -2260,10 +2248,10 @@ got_value:
END_CRITICAL_REGION; // checkpoint after this point would no longer cause a threadsafety bug END_CRITICAL_REGION; // checkpoint after this point would no longer cause a threadsafety bug
} }
r = maybe_flush_some(ct, 0); maybe_flush_some(ct, 0);
cachetable_unlock(ct); cachetable_unlock(ct);
WHEN_TRACE_CT(printf("%s:%d did fetch: cachtable_get_and_pin(%lld)--> %p\n", __FILE__, __LINE__, key, *value)); WHEN_TRACE_CT(printf("%s:%d did fetch: cachtable_get_and_pin(%lld)--> %p\n", __FILE__, __LINE__, key, *value));
return r; return 0;
} }
// Lookup a key in the cachetable. If it is found and it is not being written, then // Lookup a key in the cachetable. If it is found and it is not being written, then
...@@ -2361,10 +2349,7 @@ cachetable_unpin_internal(CACHEFILE cachefile, CACHEKEY key, u_int32_t fullhash, ...@@ -2361,10 +2349,7 @@ cachetable_unpin_internal(CACHEFILE cachefile, CACHEKEY key, u_int32_t fullhash,
WHEN_TRACE_CT(printf("[count=%lld]\n", p->pinned)); WHEN_TRACE_CT(printf("[count=%lld]\n", p->pinned));
{ {
if (flush) { if (flush) {
if ((r=maybe_flush_some(ct, 0))) { maybe_flush_some(ct, 0);
cachetable_unlock(ct);
return r;
}
} }
} }
r = 0; // we found one r = 0; // we found one
......
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