Author: tedyu
Date: Wed Jul 20 11:28:24 2011
New Revision: 1148707
URL: http://svn.apache.org/viewvc?rev=1148707&view=rev
Log:
HBASE-4095 revert to previous way of initializing initialReplication
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1148707&r1=1148706&r2=1148707&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Wed Jul 20 11:28:24 2011
@@ -501,18 +501,13 @@ public class HLog implements Syncable {
this.filenum = System.currentTimeMillis();
Path newPath = computeFilename();
HLog.Writer nextWriter = this.createWriterInstance(fs, newPath,
conf);
+ int nextInitialReplication =
fs.getFileStatus(newPath).getReplication();
+
//This method get expect but not the actual replicas of the Hlog file
int nextExpectReplicas = fs.getFileStatus(newPath).getReplication();
//Get the current replicas of the Hlog file
int nextActualReplicas = -1;
- try
- {
- nextActualReplicas = getLogReplication();
- } catch (Exception e) {
- LOG.warn("Unable to invoke DFSOutputStream.getNumCurrentReplicas"
+ e +
- " still proceeding ahead...");
- }
// Can we get at the dfsclient outputstream? If an instance of
// SFLW, it'll have done the necessary reflection to get at the
// protected field name.
@@ -531,9 +526,8 @@ public class HLog implements Syncable {
// Clean up current writer.
Path oldFile = cleanupCurrentWriter(currentFilenum);
this.writer = nextWriter;
- this.initialReplication = nextActualReplicas == -1 ?
- nextExpectReplicas : nextActualReplicas;
this.hdfs_out = nextHdfsOut;
+ this.initialReplication = nextInitialReplication;
LOG.info((oldFile != null?
"Roll " + FSUtils.getPath(oldFile) + ", entries=" +
@@ -562,7 +556,9 @@ public class HLog implements Syncable {
} finally {
this.cacheFlushLock.unlock();
}
- }
+ } else {
+ LOG.debug("Didn't obtain cacheFlushLock in time");
+ }
} catch (InterruptedException e) {
LOG.warn("Interrupted rollWriter", e);
Thread.currentThread().interrupt();