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)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@917783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2010-03-01 23:00:55 +00:00
parent dc579e5972
commit ee54d203e9
5 changed files with 43 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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.
*

View File

@ -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) {

View File

@ -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.