mirror of https://github.com/apache/cassandra
to avoid adding work to terminating executor (which will raise an exception) we need to check for threshold violated _first_, and move puts to the new memtable once flush has started. patch by jbellis; reviewed by Eric Evans for CASSANDRA-165
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@774165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae70cea79a
commit
f86d47c242
|
|
@ -194,14 +194,19 @@ public class Memtable implements Comparable<Memtable>
|
|||
* the memtable. This version will respect the threshold and flush
|
||||
* the memtable to disk when the size exceeds the threshold.
|
||||
*/
|
||||
void put(String key, ColumnFamily columnFamily, CommitLog.CommitLogContext cLogCtx) throws IOException
|
||||
public void put(String key, ColumnFamily columnFamily, CommitLog.CommitLogContext cLogCtx) throws IOException
|
||||
{
|
||||
isDirty_ = true;
|
||||
executor_.submit(new Putter(key, columnFamily));
|
||||
if (isThresholdViolated())
|
||||
{
|
||||
enqueueFlush(cLogCtx);
|
||||
// retry the put on the new memtable
|
||||
ColumnFamilyStore cfStore = Table.open(table_).getColumnFamilyStore(cfName_);
|
||||
cfStore.apply(key, columnFamily, cLogCtx);
|
||||
return;
|
||||
}
|
||||
|
||||
isDirty_ = true;
|
||||
executor_.submit(new Putter(key, columnFamily));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue