You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2007/08/31 00:12:45 UTC
svn commit: r571333 - in
/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase:
HMemcache.java HRegion.java
Author: jimk
Date: Thu Aug 30 15:12:45 2007
New Revision: 571333
URL: http://svn.apache.org/viewvc?rev=571333&view=rev
Log:
HADOOP-1797 Fix NPEs in MetaScanner constructor
Modified:
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java
Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java?rev=571333&r1=571332&r2=571333&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java Thu Aug 30 15:12:45 2007
@@ -58,9 +58,7 @@
/**
* Constructor
*/
- public HMemcache() {
- super();
- }
+ public HMemcache() {}
/** represents the state of the memcache at a specified point in time */
static class Snapshot {
@@ -320,7 +318,7 @@
// Generate list of iterators
HStoreKey firstKey = new HStoreKey(firstRow);
for(int i = 0; i < backingMaps.length; i++) {
- keyIterators[i] = (firstRow.getLength() != 0)?
+ keyIterators[i] = (/*firstRow != null &&*/ firstRow.getLength() != 0)?
backingMaps[i].tailMap(firstKey).keySet().iterator():
backingMaps[i].keySet().iterator();
while(getNext(i)) {
Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java?rev=571333&r1=571332&r2=571333&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java Thu Aug 30 15:12:45 2007
@@ -208,6 +208,7 @@
final int memcacheFlushSize;
final int blockingMemcacheSize;
+ protected final long threadWakeFrequency;
private final HLocking lock = new HLocking();
private long desiredMaxFileSize;
private final long maxSequenceId;
@@ -244,6 +245,7 @@
this.conf = conf;
this.regionInfo = regionInfo;
this.memcache = new HMemcache();
+ this.threadWakeFrequency = conf.getLong(THREAD_WAKE_FREQUENCY, 10 * 1000);
// Declare the regionName. This is a unique string for the region, used to
// build a unique filename.
@@ -1055,24 +1057,28 @@
* the notify.
*/
private synchronized void checkResources() {
- if (checkCommitsSinceFlush()) {
- return;
- }
+ boolean blocked = false;
- LOG.warn("Blocking updates for '" + Thread.currentThread().getName() +
- "': Memcache size " +
- StringUtils.humanReadableInt(this.memcache.getSize()) +
- " is >= than blocking " +
- StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size");
while (!checkCommitsSinceFlush()) {
+ if (!blocked) {
+ LOG.info("Blocking updates for '" + Thread.currentThread().getName() +
+ "': Memcache size " +
+ StringUtils.humanReadableInt(this.memcache.getSize()) +
+ " is >= than blocking " +
+ StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size");
+ }
+
+ blocked = true;
try {
- wait();
+ wait(threadWakeFrequency);
} catch (InterruptedException e) {
// continue;
}
}
- LOG.warn("Unblocking updates for '" + Thread.currentThread().getName() +
- "'");
+ if (blocked) {
+ LOG.info("Unblocking updates for '" + Thread.currentThread().getName() +
+ "'");
+ }
}
/*
@@ -1635,4 +1641,4 @@
public static Path getRegionDir(final Path dir, final Text regionName) {
return new Path(dir, new Path(HREGIONDIR_PREFIX + regionName));
}
-}
\ No newline at end of file
+}