Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AD9F10090 for ; Thu, 12 Sep 2013 16:38:57 +0000 (UTC) Received: (qmail 4315 invoked by uid 500); 12 Sep 2013 16:38:40 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 4258 invoked by uid 500); 12 Sep 2013 16:38:37 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 2052 invoked by uid 99); 12 Sep 2013 16:38:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Sep 2013 16:38:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E08788BFFBE; Thu, 12 Sep 2013 16:38:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ecn@apache.org To: commits@accumulo.apache.org Date: Thu, 12 Sep 2013 16:38:21 -0000 Message-Id: <21b9a6b0886446b9a76adc642f7d2fe7@git.apache.org> In-Reply-To: <14d248894a3e4447bb8f5e3ec29cddd5@git.apache.org> References: <14d248894a3e4447bb8f5e3ec29cddd5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/10] git commit: ACCUMULO-1452 remove any junk _tmp files when openning the tablet ACCUMULO-1452 remove any junk _tmp files when openning the tablet Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a238494d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a238494d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a238494d Branch: refs/heads/master Commit: a238494dd803f5c800dfcaf90b81dab3d1c7d9a6 Parents: 0531614 Author: Eric Newton Authored: Thu Sep 12 11:20:46 2013 -0400 Committer: Eric Newton Committed: Thu Sep 12 11:20:46 2013 -0400 ---------------------------------------------------------------------- .../accumulo/server/tabletserver/Tablet.java | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a238494d/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java ---------------------------------------------------------------------- diff --git a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java index 20ae892..f3c756a 100644 --- a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java +++ b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java @@ -372,7 +372,7 @@ public class Tablet { private long persistedTime; private Object timeLock = new Object(); - private Path location; // absolute path of this tablets dir + private final Path location; // absolute path of this tablets dir private TServerInstance lastLocation; private Configuration conf; @@ -406,8 +406,6 @@ public class Tablet { private AtomicReference constraintChecker = new AtomicReference(); - private String tabletDirectory; - private int writesInProgress = 0; private static final Logger log = Logger.getLogger(Tablet.class); @@ -1333,7 +1331,6 @@ public class Tablet { Set scanFiles, long initFlushID, long initCompactID) throws IOException { this.location = new Path(ServerConstants.getTablesDir() + "/" + extent.getTableId().toString() + location.toString()); this.lastLocation = lastLocation; - this.tabletDirectory = location.toString(); this.conf = conf; this.acuTableConf = ServerConfiguration.getTableConfiguration(extent.getTableId().toString()); @@ -1484,6 +1481,8 @@ public class Tablet { + " entries created)"); } + removeOldTemporaryFiles(); + // do this last after tablet is completely setup because it // could cause major compaction to start datafileManager = new DatafileManager(datafiles); @@ -1495,6 +1494,21 @@ public class Tablet { log.log(TLevel.TABLET_HIST, extent + " opened "); } + private void removeOldTemporaryFiles() { + // remove any temporary files created by a previous tablet server + try { + for (FileStatus tmp : fs.globStatus(new Path(location, "*_tmp"))){ + try { + fs.delete(tmp.getPath(), true); + } catch (IOException ex) { + log.error("Unable to remove old temp file " + tmp.getPath() + ": " + ex); + } + } + } catch (IOException ex) { + log.error("Error scanning for old temp files in " + location); + } + } + private void setupDefaultSecurityLabels(KeyExtent extent) { if (extent.getTableId().toString().equals(Constants.METADATA_TABLE_ID)) { defaultSecurityLabel = new byte[0]; @@ -3520,7 +3534,7 @@ public class Tablet { log.log(TLevel.TABLET_HIST, extent + " split " + low + " " + high); - newTablets.put(high, new SplitInfo(tabletDirectory, highDatafileSizes, time, lastFlushID, lastCompactID)); + newTablets.put(high, new SplitInfo(location.toString(), highDatafileSizes, time, lastFlushID, lastCompactID)); newTablets.put(low, new SplitInfo(lowDirectory, lowDatafileSizes, time, lastFlushID, lastCompactID)); long t2 = System.currentTimeMillis();