HBASE-2 hlog numbers should wrap around when they reach 999
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@619657 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1d831be81a
commit
93a31f6a16
|
@ -13,6 +13,8 @@ HBase Change Log
|
|||
(Stu Hood and Bryan Duxbury via Stack)
|
||||
HBASE-28 thrift put/mutateRow methods need to throw IllegalArgument exceptions
|
||||
(Dave Simpson via Bryan Duxbury via Stack)
|
||||
HBASE-2 hlog numbers should wrap around when they reach 999
|
||||
(Bryan Duxbury via Stack)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-415 Rewrite leases to use DelayedBlockingQueue instead of polling
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
# The java implementation to use. Required.
|
||||
# export JAVA_HOME=/usr/lib/j2sdk1.5-sun
|
||||
export JAVA_HOME=/usr
|
||||
|
||||
# Extra Java CLASSPATH elements. Optional.
|
||||
# export HBASE_CLASSPATH=
|
||||
|
|
|
@ -119,7 +119,8 @@ public class HLog implements HConstants {
|
|||
volatile long logSeqNum = 0;
|
||||
|
||||
volatile long filenum = 0;
|
||||
|
||||
volatile long old_filenum = -1;
|
||||
|
||||
volatile int numEntries = 0;
|
||||
|
||||
// This lock prevents starting a log roll during a cache flush.
|
||||
|
@ -215,7 +216,7 @@ public class HLog implements HConstants {
|
|||
if (this.writer != null) {
|
||||
// Close the current writer, get a new one.
|
||||
this.writer.close();
|
||||
Path p = computeFilename(filenum - 1);
|
||||
Path p = computeFilename(old_filenum);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Closing current log writer " + p.toString() +
|
||||
" to get a new one");
|
||||
|
@ -226,7 +227,9 @@ public class HLog implements HConstants {
|
|||
}
|
||||
}
|
||||
}
|
||||
Path newPath = computeFilename(filenum++);
|
||||
old_filenum = filenum;
|
||||
filenum = System.currentTimeMillis();
|
||||
Path newPath = computeFilename(filenum);
|
||||
this.writer = SequenceFile.createWriter(this.fs, this.conf, newPath,
|
||||
HLogKey.class, HLogEdit.class, getCompressionType(this.conf));
|
||||
LOG.info("new log writer created at " + newPath);
|
||||
|
@ -294,8 +297,7 @@ public class HLog implements HConstants {
|
|||
* file-number.
|
||||
*/
|
||||
Path computeFilename(final long fn) {
|
||||
return new Path(dir,
|
||||
HLOG_DATFILE + String.format("%1$03d", Long.valueOf(fn)));
|
||||
return new Path(dir, HLOG_DATFILE + new Long(fn).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,7 +110,7 @@ public class TestHLog extends HBaseTestCase implements HConstants {
|
|||
long logSeqId = log.startCacheFlush();
|
||||
log.completeCacheFlush(regionName, tableName, logSeqId);
|
||||
log.close();
|
||||
Path filename = log.computeFilename(log.filenum - 1);
|
||||
Path filename = log.computeFilename(log.filenum);
|
||||
log = null;
|
||||
// Now open a reader on the log and assert append worked.
|
||||
reader = new SequenceFile.Reader(fs, filename, conf);
|
||||
|
|
Loading…
Reference in New Issue