diff --git a/CHANGES.txt b/CHANGES.txt index a0b43004c77..74ac856de3e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -395,6 +395,10 @@ Release 0.21.0 - Unreleased HBASE-2262 ZKW.ensureExists should check for existence HBASE-2264 Adjust the contrib apps to the Maven project layout (Lars Francke via Lars George) + HBASE-2245 Unnecessary call to syncWal(region); in HRegionServer + (Benoit Sigoure via JD) + HBASE-2246 Add a getConfiguration method to HTableInterface + (Benoit Sigoure via JD) NEW FEATURES HBASE-1961 HBase EC2 scripts diff --git a/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java index ed9d1547179..031bbf173df 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -155,6 +155,10 @@ public class HTable implements HTableInterface { new DaemonThreadFactory()); } + public Configuration getConfiguration() { + return configuration; + } + /** * TODO Might want to change this to public, would be nice if the number * of threads would automatically change when servers were added and removed diff --git a/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java b/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java index e550257117e..5d4a039a71e 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java +++ b/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java @@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.client; import java.io.IOException; import java.util.List; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HTableDescriptor; /** @@ -37,6 +38,13 @@ public interface HTableInterface { */ byte[] getTableName(); + /** + * Gets the configuration of this instance. + * + * @return The configuration. + */ + Configuration getConfiguration(); + /** * Gets the table descriptor for this table. * diff --git a/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index bcf908eb05d..48d312467bf 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1684,9 +1684,12 @@ public class HRegionServer implements HConstants, HRegionInterface, if (!region.getRegionInfo().isMetaTable()) { this.cacheFlusher.reclaimMemStoreMemory(); } - region.put(put, getLockFromId(put.getLockId())); + boolean writeToWAL = put.getWriteToWAL(); + region.put(put, getLockFromId(put.getLockId()), writeToWAL); - this.syncWal(region); + if (writeToWAL) { + this.syncWal(region); + } } catch (Throwable t) { throw convertThrowableToIOE(cleanup(t)); } @@ -1698,6 +1701,7 @@ public class HRegionServer implements HConstants, HRegionInterface, int i = 0; checkOpen(); HRegion region = null; + boolean writeToWAL = true; try { region = getRegion(regionName); if (!region.getRegionInfo().isMetaTable()) { @@ -1706,6 +1710,7 @@ public class HRegionServer implements HConstants, HRegionInterface, for (i = 0; i < puts.length; i++) { this.requestCount.incrementAndGet(); Integer lock = getLockFromId(puts[i].getLockId()); + writeToWAL &= puts[i].getWriteToWAL(); region.put(puts[i], lock); } @@ -1720,7 +1725,9 @@ public class HRegionServer implements HConstants, HRegionInterface, } // All have been processed successfully. - this.syncWal(region); + if (writeToWAL) { + this.syncWal(region); + } return -1; } @@ -2378,7 +2385,9 @@ public class HRegionServer implements HConstants, HRegionInterface, long retval = region.incrementColumnValue(row, family, qualifier, amount, writeToWAL); - syncWal(region); + if (writeToWAL) { + syncWal(region); + } return retval; } catch (IOException e) { diff --git a/core/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/core/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java index 5227a050129..f9bae507e43 100644 --- a/core/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/core/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.client; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -106,6 +107,19 @@ public class TestFromClientSide { // Nothing to do. } + /** + * Verifies that getConfiguration returns the same Configuration object used + * to create the HTable instance. + */ + @Test + public void testGetConfiguration() throws Exception { + byte[] TABLE = Bytes.toBytes("testGetConfiguration"); + byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") }; + Configuration conf = TEST_UTIL.getConfiguration(); + HTable table = TEST_UTIL.createTable(TABLE, FAMILIES); + assertSame(conf, table.getConfiguration()); + } + /** * Test from client side of an involved filter against a multi family that * involves deletes.