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 33064104B6 for ; Wed, 5 Mar 2014 23:05:30 +0000 (UTC) Received: (qmail 12446 invoked by uid 500); 5 Mar 2014 23:05:26 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 12387 invoked by uid 500); 5 Mar 2014 23:05:25 -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 12376 invoked by uid 99); 5 Mar 2014 23:05:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2014 23:05:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 328CA937EAD; Wed, 5 Mar 2014 23:05:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kturner@apache.org To: commits@accumulo.apache.org Date: Wed, 05 Mar 2014 23:05:25 -0000 Message-Id: <1e73ccb8689d42f0b016aa1e33a03005@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/5] git commit: ACCUMULO-2428 throw exception when rename fails after compaction Repository: accumulo Updated Branches: refs/heads/1.6.0-SNAPSHOT 1392e07fb -> 80febfa6c ACCUMULO-2428 throw exception when rename fails after compaction Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4fd48fd2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4fd48fd2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4fd48fd2 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 4fd48fd2390cc3f4f2e76933833506ab26132c2c Parents: 4cd12c4 Author: Keith Turner Authored: Wed Mar 5 17:29:40 2014 -0500 Committer: Keith Turner Committed: Wed Mar 5 17:29:40 2014 -0500 ---------------------------------------------------------------------- .../accumulo/server/tabletserver/Tablet.java | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd48fd2/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 9bf4f96..2d01121 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 @@ -808,9 +808,7 @@ public class Tablet { fs.delete(newDatafile, true); } - if (!fs.rename(tmpDatafile, newDatafile)) { - throw new IOException("rename fails"); - } + rename(fs, tmpDatafile, newDatafile); } break; } catch (IOException ioe) { @@ -981,8 +979,7 @@ public class Tablet { // rename before putting in metadata table, so files in metadata table should // always exist - if (!fs.rename(tmpDatafile, newDatafile)) - log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false"); + rename(fs, tmpDatafile, newDatafile); if (dfv.getNumEntries() == 0) { fs.delete(newDatafile, true); @@ -1018,7 +1015,7 @@ public class Tablet { String compactName = newDatafile.getName(); for (Path path : oldDatafiles) { - fs.rename(path, new Path(location + "/delete+" + compactName + "+" + path.getName())); + rename(fs, path, new Path(location + "/delete+" + compactName + "+" + path.getName())); } if (fs.exists(newDatafile)) { @@ -1026,8 +1023,7 @@ public class Tablet { throw new IllegalStateException("Target map file already exist " + newDatafile); } - if (!fs.rename(tmpDatafile, newDatafile)) - log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false"); + rename(fs, tmpDatafile, newDatafile); // start deleting files, if we do not finish they will be cleaned // up later @@ -1561,8 +1557,7 @@ public class Tablet { filename = filename.split("\\+", 3)[2]; path = location + "/" + filename; - if (!fs.rename(file.getPath(), new Path(path))) - log.warn("Rename of " + file.getPath().toString() + " to " + path + " returned false"); + rename(fs, file.getPath(), new Path(path)); } if (filename.endsWith("_tmp")) { @@ -3312,6 +3307,12 @@ public class Tablet { return smallestFiles; } + private static void rename(FileSystem fs, Path src, Path dst) throws IOException { + if (!fs.rename(src, dst)) { + throw new IOException("Rename " + src + " to " + dst + " returned false "); + } + } + // END PRIVATE METHODS RELATED TO MAJOR COMPACTION /**