You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/24 23:26:40 UTC
svn commit: r1188391 - in /hbase/branches/0.92: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java
Author: nspiegelberg
Date: Mon Oct 24 21:26:39 2011
New Revision: 1188391
URL: http://svn.apache.org/viewvc?rev=1188391&view=rev
Log:
HBASE-4591 TTL for old HLogs should be calculated from last modification time.
Modified:
hbase/branches/0.92/CHANGES.txt
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java
Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1188391&r1=1188390&r2=1188391&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Oct 24 21:26:39 2011
@@ -362,6 +362,7 @@ Release 0.92.0 - Unreleased
configurations need to be done as integers (dhruba)
HBASE-4647 RAT finds about 40 files missing licenses
HBASE-4642 Add Apache License Header
+ HBASE-4591 TTL for old HLogs should be calculated from last modification time
TESTS
HBASE-4492 TestRollingRestart fails intermittently
Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java?rev=1188391&r1=1188390&r2=1188391&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/TimeToLiveLogCleaner.java Mon Oct 24 21:26:39 2011
@@ -19,6 +19,9 @@
*/
package org.apache.hadoop.hbase.master;
+import java.io.IOException;
+
+import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
import org.apache.commons.logging.Log;
@@ -39,13 +42,13 @@ public class TimeToLiveLogCleaner implem
public boolean isLogDeletable(Path filePath) {
long time = 0;
long currentTime = System.currentTimeMillis();
- String[] parts = filePath.getName().split("\\.");
try {
- time = Long.parseLong(parts[parts.length-1]);
- } catch (NumberFormatException e) {
- LOG.error("Unable to parse the timestamp in " + filePath.getName() +
- ", deleting it since it's invalid and may not be a hlog", e);
- return true;
+ FileStatus fStat = filePath.getFileSystem(conf).getFileStatus(filePath);
+ time = fStat.getModificationTime();
+ } catch (IOException e) {
+ LOG.error("Unable to get modification time of file " + filePath.getName() +
+ ", not deleting it.", e);
+ return false;
}
long life = currentTime - time;
if (life < 0) {