diff --git a/CHANGES.txt b/CHANGES.txt index d3ddf00ebbf..70b0865c273 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,8 @@ Release 0.18.2 - Unreleased (back port from trunk) HBASE-1052 Stopping a HRegionServer with unflushed cache causes data loss from org.apache.hadoop.hbase.DroppedSnapshotException + HBASE-981 hbase.io.index.interval doesn't seem to have an effect; + interval is 128 rather than the configured 32 IMPROVEMENTS HBASE-1046 Narrow getClosestRowBefore by passing column family (backport) diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java index b3c28dcf9bb..e6cc2b88ed1 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -600,7 +600,7 @@ public class HStore implements HConstants { this.info, family.getName(), -1L, null); MapFile.Writer out = flushedFile.getWriter(this.fs, this.compression, this.family.isBloomfilter(), cache.size()); - out.setIndexInterval(family.getMapFileIndexInterval()); + setIndexInterval(out); // Here we tried picking up an existing HStoreFile from disk and // interlacing the memcache flush compacting as we go. The notion was @@ -648,6 +648,27 @@ public class HStore implements HConstants { } return storefiles.size() >= compactionThreshold; } + + /* + * Set the index interval for the mapfile. There are two sources for + * configuration information: the HCD, and the global HBase config. + * If a source returns the default value, it is ignored. Otherwise, + * the smallest non-default value is preferred. + */ + private void setIndexInterval(MapFile.Writer writer) { + int familyInterval = this.family.getMapFileIndexInterval(); + int interval = this.conf.getInt("hbase.io.index.interval", + HColumnDescriptor.DEFAULT_MAPFILE_INDEX_INTERVAL); + if (familyInterval != HColumnDescriptor.DEFAULT_MAPFILE_INDEX_INTERVAL) { + if (interval != HColumnDescriptor.DEFAULT_MAPFILE_INDEX_INTERVAL) { + if (familyInterval < interval) + interval = familyInterval; + } else { + interval = familyInterval; + } + } + writer.setIndexInterval(interval); + } /* * Change readers adding into place the Reader produced by this new flush. @@ -888,7 +909,7 @@ public class HStore implements HConstants { } MapFile.Writer writer = compactedOutputFile.getWriter(this.fs, this.compression, this.family.isBloomfilter(), nrows); - writer.setIndexInterval(family.getMapFileIndexInterval()); + setIndexInterval(writer); try { compact(writer, rdrs, majorCompaction); } finally {