HBASE-1944 Add a "deferred log flush" attribute to HTD

caching the boolean


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@832259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-11-03 01:50:34 +00:00
parent 96dfa4a2bf
commit 4631663ed8
1 changed files with 8 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@ -98,6 +99,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
private volatile Boolean meta = null; private volatile Boolean meta = null;
private volatile Boolean root = null; private volatile Boolean root = null;
private Boolean isDeferredLog = null;
// Key is hash of the family name. // Key is hash of the family name.
public final Map<byte [], HColumnDescriptor> families = public final Map<byte [], HColumnDescriptor> families =
@ -374,8 +376,12 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
/** /**
* @return true if that table's log is hflush by other means * @return true if that table's log is hflush by other means
*/ */
public boolean isDeferredLogFlush() { public synchronized boolean isDeferredLogFlush() {
return isSomething(DEFERRED_LOG_FLUSH_KEY, DEFAULT_DEFERRED_LOG_FLUSH); if(this.isDeferredLog == null) {
this.isDeferredLog =
isSomething(DEFERRED_LOG_FLUSH_KEY, DEFAULT_DEFERRED_LOG_FLUSH);
}
return this.isDeferredLog;
} }
/** /**