You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/05/16 21:23:41 UTC
svn commit: r775512 - in /hadoop/hbase/trunk_on_hadoop-0.18.3: ./ conf/
src/java/org/apache/hadoop/hbase/client/
src/java/org/apache/hadoop/hbase/master/
src/java/org/apache/hadoop/hbase/regionserver/
src/java/org/apache/hadoop/hbase/regionserver/table...
Author: apurtell
Date: Sat May 16 19:23:41 2009
New Revision: 775512
URL: http://svn.apache.org/viewvc?rev=775512&view=rev
Log:
HBASE-1008, HBASE-1429
Modified:
hadoop/hbase/trunk_on_hadoop-0.18.3/CHANGES.txt
hadoop/hbase/trunk_on_hadoop-0.18.3/conf/hbase-default.xml
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/client/HTablePool.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/master/HMaster.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HLogKey.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegionServer.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalHLogManager.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegionServer.java
hadoop/hbase/trunk_on_hadoop-0.18.3/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/CHANGES.txt?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/CHANGES.txt (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/CHANGES.txt Sat May 16 19:23:41 2009
@@ -248,7 +248,11 @@
HBASE-1417 Cleanup disorientating RPC message
HBASE-1424 have shell print regioninfo and location on first load if
DEBUG enabled
- HBASE-1008 [performance] The replay of logs on server crash takes way too long
+ HBASE-1008 [performance] The replay of logs on server crash takes way too
+ long
+ HBASE-1394 Uploads sometimes fall to 0 requests/second (Binding up on
+ HLog#append?)
+ HBASE-1429 Allow passing of a configuration object to HTablePool
OPTIMIZATIONS
HBASE-1412 Change values for delete column and column family in KeyValue
@@ -278,7 +282,8 @@
HBASE-912 PE is broken when other tables exist
HBASE-853 [shell] Cannot describe meta tables (Izaak Rubin via Stack)
HBASE-844 Can't pass script to hbase shell
- HBASE-837 Add unit tests for ThriftServer.HBaseHandler (Izaak Rubin via Stack)
+ HBASE-837 Add unit tests for ThriftServer.HBaseHandler (Izaak Rubin via
+ Stack)
HBASE-913 Classes using log4j directly
HBASE-914 MSG_REPORT_CLOSE has a byte array for a message
HBASE-918 Region balancing during startup makes cluster unstable
@@ -289,7 +294,7 @@
HBASE-924 Update hadoop in lib on 0.18 hbase branch to 0.18.1
HBASE-929 Clarify that ttl in HColumnDescriptor is seconds
HBASE-930 RegionServer stuck: HLog: Could not append. Requesting close of
- log java.io.IOException: Could not get block locations. Aborting...
+ log java.io.IOException: Could not get block locations
HBASE-926 If no master, regionservers should hang out rather than fail on
connection and shut themselves down
HBASE-919 Master and Region Server need to provide root region location if
@@ -299,11 +304,13 @@
HBASE-939 NPE in HStoreKey
HBASE-945 Be consistent in use of qualified/unqualified mapfile paths
HBASE-946 Row with 55k deletes timesout scanner lease
- HBASE-950 HTable.commit no longer works with existing RowLocks though it's still in API
+ HBASE-950 HTable.commit no longer works with existing RowLocks though it's
+ still in API
HBASE-952 Deadlock in HRegion.batchUpdate
HBASE-954 Don't reassign root region until ProcessServerShutdown has split
the former region server's log
- HBASE-957 PerformanceEvaluation tests if table exists by comparing descriptors
+ HBASE-957 PerformanceEvaluation tests if table exists by comparing
+ descriptors
HBASE-728, HBASE-956, HBASE-955 Address thread naming, which threads are
Chores, vs Threads, make HLog manager the write ahead log and
not extend it to provided optional HLog sync operations.
@@ -318,7 +325,8 @@
HBASE-977 Arcane HStoreKey comparator bug
HBASE-979 REST web app is not started automatically
HBASE-980 Undo core of HBASE-975, caching of start and end row
- HBASE-982 Deleting a column in MapReduce fails (DoÄacan Güney via Stack)
+ HBASE-982 Deleting a column in MapReduce fails (DoÄacan Güney via
+ Stack)
HBASE-984 Fix javadoc warnings
HBASE-985 Fix javadoc warnings
HBASE-951 Either shut down master or let it finish cleanup
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/conf/hbase-default.xml
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/conf/hbase-default.xml?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/conf/hbase-default.xml (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/conf/hbase-default.xml Sat May 16 19:23:41 2009
@@ -175,14 +175,6 @@
</description>
</property>
<property>
- <name>hbase.regionserver.maxlogentries</name>
- <value>100000</value>
- <description>Rotate the HRegion HLogs when count of entries exceeds this
- value. Default: 100,000. Value is checked by a thread that runs every
- hbase.server.thread.wakefrequency.
- </description>
- </property>
- <property>
<name>hbase.regionserver.flushlogentries</name>
<value>100</value>
<description>Sync the HLog to the HDFS when it has accumulated this many
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/client/HTablePool.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/client/HTablePool.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/client/HTablePool.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/client/HTablePool.java Sat May 16 19:23:41 2009
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.TreeMap;
+import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.util.Bytes;
/**
@@ -39,6 +40,7 @@
private static final Map<byte[], HTablePool> poolMap =
new TreeMap<byte[], HTablePool>(Bytes.BYTES_COMPARATOR);
+ private final HBaseConfiguration config;
private final byte[] tableName;
private final Deque<HTable> pool;
private final int maxSize;
@@ -48,8 +50,18 @@
* @param tableName the table name
* @return the table pool
*/
+ public static HTablePool getPool(HBaseConfiguration config,
+ byte[] tableName) {
+ return getPool(config, tableName, 10);
+ }
+
+ /**
+ * Get a shared table pool.
+ * @param tableName the table name
+ * @return the table pool
+ */
public static HTablePool getPool(byte[] tableName) {
- return getPool(tableName, 10);
+ return getPool(new HBaseConfiguration(), tableName, 10);
}
/**
@@ -59,15 +71,17 @@
* shared pool will be allocated with <i>maxSize</i> as the size limit.
* However, if the shared pool already exists, and was created with a
* different (or default) value for <i>maxSize</i>, it will not be changed.
+ * @param config HBase configuration
* @param tableName the table name
* @param maxSize the maximum size of the pool
* @return the table pool
*/
- public static HTablePool getPool(byte[] tableName, int maxSize) {
+ public static HTablePool getPool(HBaseConfiguration config, byte[] tableName,
+ int maxSize) {
synchronized (poolMap) {
HTablePool pool = poolMap.get(tableName);
if (pool == null) {
- pool = new HTablePool(tableName, maxSize);
+ pool = new HTablePool(config, tableName, maxSize);
poolMap.put(tableName, pool);
}
return pool;
@@ -75,12 +89,16 @@
}
/**
- * Constructor
+ * Constructor
+ * @param config HBase configuration
* @param tableName the table name
+ * @param maxSize maximum pool size
*/
- public HTablePool(byte[] tableName) {
+ public HTablePool(HBaseConfiguration config, byte[] tableName,
+ int maxSize) {
+ this.config = config;
this.tableName = tableName;
- this.maxSize = 10;
+ this.maxSize = maxSize;
this.pool = new ArrayDeque<HTable>(this.maxSize);
}
@@ -90,9 +108,15 @@
* @param maxSize maximum pool size
*/
public HTablePool(byte[] tableName, int maxSize) {
- this.tableName = tableName;
- this.maxSize = maxSize;
- this.pool = new ArrayDeque<HTable>(this.maxSize);
+ this(new HBaseConfiguration(), tableName, maxSize);
+ }
+
+ /**
+ * Constructor
+ * @param tableName the table name
+ */
+ public HTablePool(byte[] tableName) {
+ this(new HBaseConfiguration(), tableName, 10);
}
/**
@@ -109,7 +133,7 @@
return pool.pop();
}
}
- return new HTable(tableName);
+ return new HTable(config, tableName);
}
/**
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/master/HMaster.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/master/HMaster.java Sat May 16 19:23:41 2009
@@ -267,7 +267,6 @@
this.rootdir, this.conf);
HRegion meta = HRegion.createHRegion(HRegionInfo.FIRST_META_REGIONINFO,
this.rootdir, this.conf);
-
// Add first region from the META table to the ROOT region.
HRegion.addRegionToMETA(root, meta);
root.close();
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HLogKey.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HLogKey.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HLogKey.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HLogKey.java Sat May 16 19:23:41 2009
@@ -19,6 +19,8 @@
*/
package org.apache.hadoop.hbase.regionserver;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.io.HeapSize;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.*;
@@ -34,14 +36,18 @@
* <p>Some Transactional edits (START, COMMIT, ABORT) will not have an
* associated row.
*/
-public class HLogKey implements WritableComparable<HLogKey> {
+public class HLogKey implements WritableComparable<HLogKey>, HeapSize {
private byte [] regionName;
private byte [] tablename;
private long logSeqNum;
+ // Time at which this edit was written.
+ private long writeTime;
+ private int HEAP_TAX = HeapSize.OBJECT + (2 * HeapSize.BYTE_ARRAY) +
+ (2 * HeapSize.LONG);
- /** Create an empty key useful when deserializing */
+ /** Writable Consructor -- Do not use. */
public HLogKey() {
- this(null, null, 0L);
+ this(null, null, 0L, HConstants.LATEST_TIMESTAMP);
}
/**
@@ -52,12 +58,14 @@
* @param regionName - name of region
* @param tablename - name of table
* @param logSeqNum - log sequence number
+ * @param now Time at which this edit was written.
*/
public HLogKey(final byte [] regionName, final byte [] tablename,
- long logSeqNum) {
+ long logSeqNum, final long now) {
this.regionName = regionName;
this.tablename = tablename;
this.logSeqNum = logSeqNum;
+ this.writeTime = now;
}
//////////////////////////////////////////////////////////////////////////////
@@ -78,7 +86,11 @@
public long getLogSeqNum() {
return logSeqNum;
}
-
+
+ public long getWriteTime() {
+ return this.writeTime;
+ }
+
@Override
public String toString() {
return Bytes.toString(tablename) + "/" + Bytes.toString(regionName) + "/" +
@@ -100,38 +112,44 @@
public int hashCode() {
int result = this.regionName.hashCode();
result ^= this.logSeqNum;
+ result ^= this.writeTime;
return result;
}
- //
- // Comparable
- //
-
public int compareTo(HLogKey o) {
int result = Bytes.compareTo(this.regionName, o.regionName);
- if(result == 0) {
+ if (result == 0) {
if (this.logSeqNum < o.logSeqNum) {
result = -1;
} else if (this.logSeqNum > o.logSeqNum) {
result = 1;
}
+ if (result == 0) {
+ if (this.writeTime < o.writeTime) {
+ result = -1;
+ } else if (this.writeTime > o.writeTime) {
+ return 1;
+ }
+ }
}
return result;
}
- //
- // Writable
- //
-
public void write(DataOutput out) throws IOException {
Bytes.writeByteArray(out, this.regionName);
Bytes.writeByteArray(out, this.tablename);
out.writeLong(logSeqNum);
+ out.writeLong(this.writeTime);
}
public void readFields(DataInput in) throws IOException {
this.regionName = Bytes.readByteArray(in);
this.tablename = Bytes.readByteArray(in);
this.logSeqNum = in.readLong();
+ this.writeTime = in.readLong();
+ }
+
+ public long heapSize() {
+ return this.regionName.length + this.tablename.length + HEAP_TAX;
}
}
\ No newline at end of file
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Sat May 16 19:23:41 2009
@@ -1341,7 +1341,7 @@
edits.add(kv);
}
if (!edits.isEmpty()) {
- update(edits, writeToWAL);
+ update(edits, writeToWAL, now);
}
if (latestTimestampDeletes != null &&
!latestTimestampDeletes.isEmpty()) {
@@ -1349,7 +1349,7 @@
// as edits. Need to do individually after figuring which is latest
// timestamp to delete.
for (byte [] column: latestTimestampDeletes) {
- deleteMultiple(row, column, LATEST_TIMESTAMP, 1);
+ deleteMultiple(row, column, LATEST_TIMESTAMP, 1, now);
}
}
} finally {
@@ -1387,6 +1387,7 @@
splitsAndClosesLock.readLock().lock();
try {
byte[] row = b.getRow();
+ long now = System.currentTimeMillis();
Integer lid = getLock(lockid,row);
try {
NavigableSet<byte []> keySet =
@@ -1404,7 +1405,7 @@
}
if (success) {
long commitTime = (b.getTimestamp() == LATEST_TIMESTAMP)?
- System.currentTimeMillis(): b.getTimestamp();
+ now: b.getTimestamp();
Set<byte []> latestTimestampDeletes = null;
List<KeyValue> edits = new ArrayList<KeyValue>();
for (BatchOperation op: b) {
@@ -1431,7 +1432,7 @@
edits.add(kv);
}
if (!edits.isEmpty()) {
- update(edits, writeToWAL);
+ update(edits, writeToWAL, now);
}
if (latestTimestampDeletes != null &&
!latestTimestampDeletes.isEmpty()) {
@@ -1439,7 +1440,7 @@
// as edits. Need to do individually after figuring which is latest
// timestamp to delete.
for (byte [] column: latestTimestampDeletes) {
- deleteMultiple(row, column, LATEST_TIMESTAMP, 1);
+ deleteMultiple(row, column, LATEST_TIMESTAMP, 1, now);
}
}
}
@@ -1530,7 +1531,7 @@
try {
// Delete ALL versions rather than column family VERSIONS. If we just did
// VERSIONS, then if 2* VERSION cells, subsequent gets would get old stuff.
- deleteMultiple(row, column, ts, ALL_VERSIONS);
+ deleteMultiple(row, column, ts, ALL_VERSIONS, System.currentTimeMillis());
} finally {
if(lockid == null) releaseRowLock(lid);
}
@@ -1547,9 +1548,10 @@
throws IOException {
checkReadOnly();
Integer lid = getLock(lockid, row);
+ long now = System.currentTimeMillis();
long time = ts;
if (ts == HConstants.LATEST_TIMESTAMP) {
- time = System.currentTimeMillis();
+ time = now;
}
KeyValue kv = KeyValue.createFirstOnRow(row, time);
try {
@@ -1561,7 +1563,7 @@
// This is UGLY. COPY OF KEY PART OF KeyValue.
edits.add(key.cloneDelete());
}
- update(edits);
+ update(edits, now);
}
} finally {
if (lockid == null) releaseRowLock(lid);
@@ -1594,7 +1596,7 @@
for (KeyValue key: keyvalues) {
edits.add(key.cloneDelete());
}
- update(edits);
+ update(edits, now);
}
} finally {
if(lockid == null) releaseRowLock(lid);
@@ -1629,7 +1631,7 @@
for (KeyValue kv: keyvalues) {
edits.add(kv.cloneDelete());
}
- update(edits);
+ update(edits, now);
} finally {
if(lockid == null) releaseRowLock(lid);
}
@@ -1668,7 +1670,7 @@
for (KeyValue k: keyvalues) {
edits.add(k.cloneDelete());
}
- update(edits);
+ update(edits, now);
}
} finally {
if(lockid == null) releaseRowLock(lid);
@@ -1684,10 +1686,11 @@
* @param ts Timestamp to start search on.
* @param versions How many versions to delete. Pass
* {@link HConstants#ALL_VERSIONS} to delete all.
+ * @param now
* @throws IOException
*/
private void deleteMultiple(final byte [] row, final byte [] column,
- final long ts, final int versions)
+ final long ts, final int versions, final long now)
throws IOException {
checkReadOnly();
// We used to have a getKeys method that purportedly only got the keys and
@@ -1704,7 +1707,7 @@
for (KeyValue key: keys) {
edits.add(key.cloneDelete());
}
- update(edits);
+ update(edits, now);
}
}
@@ -1748,10 +1751,12 @@
* Add updates first to the hlog and then add values to memcache.
* Warning: Assumption is caller has lock on passed in row.
* @param edits Cell updates by column
+ * @praram now
* @throws IOException
*/
- private void update(final List<KeyValue> edits) throws IOException {
- this.update(edits, true);
+ private void update(final List<KeyValue> edits, final long now)
+ throws IOException {
+ this.update(edits, true, now);
}
/**
@@ -1759,9 +1764,11 @@
* Warning: Assumption is caller has lock on passed in row.
* @param writeToWAL if true, then we should write to the log
* @param updatesByColumn Cell updates by column
+ * @param now
* @throws IOException
*/
- private void update(final List<KeyValue> edits, boolean writeToWAL)
+ private void update(final List<KeyValue> edits, boolean writeToWAL,
+ final long now)
throws IOException {
if (edits == null || edits.isEmpty()) {
return;
@@ -1772,7 +1779,7 @@
if (writeToWAL) {
this.log.append(regionInfo.getRegionName(),
regionInfo.getTableDesc().getName(), edits,
- (regionInfo.isMetaRegion() || regionInfo.isRootRegion()));
+ (regionInfo.isMetaRegion() || regionInfo.isRootRegion()), now);
}
long size = 0;
for (KeyValue kv: edits) {
@@ -2273,7 +2280,7 @@
List<KeyValue> edits = new ArrayList<KeyValue>();
edits.add(new KeyValue(row, COL_REGIONINFO, System.currentTimeMillis(),
Writables.getBytes(r.getRegionInfo())));
- meta.update(edits);
+ meta.update(edits, System.currentTimeMillis());
} finally {
meta.releaseRowLock(lid);
}
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Sat May 16 19:23:41 2009
@@ -205,9 +205,9 @@
// HLog and HLog roller. log is protected rather than private to avoid
// eclipse warning when accessed by inner classes
- protected volatile HLog log;
- LogRoller logRoller;
- LogFlusher logFlusher;
+ protected volatile HLog hlog;
+ LogRoller hlogRoller;
+ LogFlusher hlogFlusher;
// limit compactions while starting up
CompactionLimitThread compactionLimitThread;
@@ -344,10 +344,10 @@
this.compactSplitThread = new CompactSplitThread(this);
// Log rolling thread
- this.logRoller = new LogRoller(this);
+ this.hlogRoller = new LogRoller(this);
// Log flushing thread
- this.logFlusher =
+ this.hlogFlusher =
new LogFlusher(this.threadWakeFrequency, this.stopRequested);
// Background thread to check for major compactions; needed if region
@@ -513,14 +513,14 @@
if (checkFileSystem()) {
closeAllRegions();
try {
- log.closeAndDelete();
+ hlog.closeAndDelete();
} catch (Exception e) {
LOG.error("error closing and deleting HLog", e);
}
try {
serverInfo.setStartCode(System.currentTimeMillis());
- log = setupHLog();
- this.logFlusher.setHLog(log);
+ hlog = setupHLog();
+ this.hlogFlusher.setHLog(hlog);
} catch (IOException e) {
this.abortRequested = true;
this.stopRequested.set(true);
@@ -620,17 +620,17 @@
// Send interrupts to wake up threads if sleeping so they notice shutdown.
// TODO: Should we check they are alive? If OOME could have exited already
cacheFlusher.interruptIfNecessary();
- logFlusher.interrupt();
+ hlogFlusher.interrupt();
compactSplitThread.interruptIfNecessary();
- logRoller.interruptIfNecessary();
+ hlogRoller.interruptIfNecessary();
this.majorCompactionChecker.interrupt();
if (abortRequested) {
if (this.fsOk) {
// Only try to clean up if the file system is available
try {
- if (this.log != null) {
- this.log.close();
+ if (this.hlog != null) {
+ this.hlog.close();
LOG.info("On abort, closed hlog");
}
} catch (Throwable e) {
@@ -644,7 +644,7 @@
} else {
ArrayList<HRegion> closedRegions = closeAllRegions();
try {
- log.closeAndDelete();
+ hlog.closeAndDelete();
} catch (Throwable e) {
LOG.error("Close and delete failed",
RemoteExceptionHandler.checkThrowable(e));
@@ -743,8 +743,8 @@
this.hdfsShutdownThread = suppressHdfsShutdownHook();
this.rootDir = new Path(this.conf.get(HConstants.HBASE_DIR));
- this.log = setupHLog();
- this.logFlusher.setHLog(log);
+ this.hlog = setupHLog();
+ this.hlogFlusher.setHLog(hlog);
// Init in here rather than in constructor after thread name has been set
this.metrics = new RegionServerMetrics();
startServiceThreads();
@@ -1058,7 +1058,7 @@
"running at " + this.serverInfo.getServerAddress().toString() +
" because logdir " + logdir.toString() + " exists");
}
- HLog newlog = new HLog(fs, logdir, conf, logRoller);
+ HLog newlog = new HLog(fs, logdir, conf, hlogRoller);
return newlog;
}
@@ -1127,9 +1127,9 @@
LOG.fatal("Set stop flag in " + t.getName(), e);
}
};
- Threads.setDaemonThreadRunning(this.logRoller, n + ".logRoller",
+ Threads.setDaemonThreadRunning(this.hlogRoller, n + ".logRoller",
handler);
- Threads.setDaemonThreadRunning(this.logFlusher, n + ".logFlusher",
+ Threads.setDaemonThreadRunning(this.hlogFlusher, n + ".logFlusher",
handler);
Threads.setDaemonThreadRunning(this.cacheFlusher, n + ".cacheFlusher",
handler);
@@ -1199,7 +1199,7 @@
}
// Verify that all threads are alive
if (!(leases.isAlive() && compactSplitThread.isAlive() &&
- cacheFlusher.isAlive() && logRoller.isAlive() &&
+ cacheFlusher.isAlive() && hlogRoller.isAlive() &&
workerThread.isAlive() && this.majorCompactionChecker.isAlive())) {
// One or more threads are no longer alive - shut down
stop();
@@ -1234,7 +1234,7 @@
/** @return the HLog */
HLog getLog() {
- return this.log;
+ return this.hlog;
}
/**
@@ -1270,7 +1270,7 @@
Threads.shutdown(this.workerThread);
Threads.shutdown(this.cacheFlusher);
Threads.shutdown(this.compactSplitThread);
- Threads.shutdown(this.logRoller);
+ Threads.shutdown(this.hlogRoller);
}
private boolean getMaster() {
@@ -1539,7 +1539,7 @@
}
this.lock.writeLock().lock();
try {
- this.log.setSequenceNumber(region.getMinSequenceId());
+ this.hlog.setSequenceNumber(region.getMinSequenceId());
this.onlineRegions.put(mapKey, region);
} finally {
this.lock.writeLock().unlock();
@@ -1551,7 +1551,7 @@
protected HRegion instantiateRegion(final HRegionInfo regionInfo)
throws IOException {
HRegion r = new HRegion(HTableDescriptor.getTableDir(rootDir, regionInfo
- .getTableDesc().getName()), this.log, this.fs, conf, regionInfo,
+ .getTableDesc().getName()), this.hlog, this.fs, conf, regionInfo,
this.cacheFlusher);
r.initialize(null, new Progressable() {
public void progress() {
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegionServer.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegionServer.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegionServer.java Sat May 16 19:23:41 2009
@@ -61,7 +61,7 @@
protected HRegion instantiateRegion(final HRegionInfo regionInfo)
throws IOException {
HRegion r = new IndexedRegion(HTableDescriptor.getTableDir(super
- .getRootDir(), regionInfo.getTableDesc().getName()), super.log, super
+ .getRootDir(), regionInfo.getTableDesc().getName()), super.hlog, super
.getFileSystem(), super.conf, regionInfo, super.getFlushRequester());
r.initialize(null, new Progressable() {
public void progress() {
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalHLogManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalHLogManager.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalHLogManager.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalHLogManager.java Sat May 16 19:23:41 2009
@@ -100,7 +100,7 @@
HLogEdit logEdit;
logEdit = new HLogEdit(transactionId, TransactionalOperation.START);
*/
- hlog.append(regionInfo, null/*logEdit*/);
+ hlog.append(regionInfo, null/*logEdit*/, System.currentTimeMillis());
}
/**
@@ -117,7 +117,7 @@
for (BatchOperation op : update) {
// COMMENTED OUT HLogEdit logEdit = new HLogEdit(transactionId, update.getRow(), op, commitTime);
- hlog.append(regionInfo, update.getRow(), null /*logEdit*/);
+ hlog.append(regionInfo, update.getRow(), null /*logEdit*/, System.currentTimeMillis());
}
}
@@ -130,7 +130,7 @@
logEdit = new HLogEdit(transactionId,
HLogEdit.TransactionalOperation.COMMIT);
*/
- hlog.append(regionInfo, null /*logEdit*/);
+ hlog.append(regionInfo, null /*logEdit*/, System.currentTimeMillis());
}
/**
@@ -141,7 +141,7 @@
/*HLogEdit logEdit;
logEdit = new HLogEdit(transactionId, HLogEdit.TransactionalOperation.ABORT);
*/
- hlog.append(regionInfo, null /*logEdit*/);
+ hlog.append(regionInfo, null /*logEdit*/, System.currentTimeMillis());
}
/**
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegionServer.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegionServer.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegionServer.java Sat May 16 19:23:41 2009
@@ -111,7 +111,7 @@
protected HRegion instantiateRegion(final HRegionInfo regionInfo)
throws IOException {
HRegion r = new TransactionalRegion(HTableDescriptor.getTableDir(super
- .getRootDir(), regionInfo.getTableDesc().getName()), super.log, super
+ .getRootDir(), regionInfo.getTableDesc().getName()), super.hlog, super
.getFileSystem(), super.conf, regionInfo, super.getFlushRequester());
r.initialize(null, new Progressable() {
public void progress() {
Modified: hadoop/hbase/trunk_on_hadoop-0.18.3/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk_on_hadoop-0.18.3/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java?rev=775512&r1=775511&r2=775512&view=diff
==============================================================================
--- hadoop/hbase/trunk_on_hadoop-0.18.3/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java (original)
+++ hadoop/hbase/trunk_on_hadoop-0.18.3/src/test/org/apache/hadoop/hbase/regionserver/TestHLog.java Sat May 16 19:23:41 2009
@@ -77,7 +77,8 @@
byte [] column = Bytes.toBytes("column:" + Integer.toString(j));
edit.add(new KeyValue(rowName, column, System.currentTimeMillis(),
column));
- log.append(Bytes.toBytes(Integer.toString(i)), tableName, edit, false);
+ log.append(Bytes.toBytes(Integer.toString(i)), tableName, edit,
+ false, System.currentTimeMillis());
}
}
log.rollWriter();
@@ -110,7 +111,7 @@
cols.add(new KeyValue(row, Bytes.toBytes("column:" + Integer.toString(i)),
timestamp, new byte[] { (byte)(i + '0') }));
}
- log.append(regionName, tableName, cols, false);
+ log.append(regionName, tableName, cols, false, System.currentTimeMillis());
long logSeqId = log.startCacheFlush();
log.completeCacheFlush(regionName, tableName, logSeqId);
log.close();