accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/5] git commit: ACCUMULO-1605 close more spans with finally clauses
Date Fri, 02 Aug 2013 20:33:43 GMT
Updated Branches:
  refs/heads/master 4bff142d3 -> 040f89121


ACCUMULO-1605 close more spans with finally clauses


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/af6c7e8d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/af6c7e8d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/af6c7e8d

Branch: refs/heads/master
Commit: af6c7e8d49b71ab1d9ac8a54572df589f627a9c1
Parents: 4bff142
Author: Eric Newton <eric.newton@gmail.com>
Authored: Fri Aug 2 16:24:15 2013 -0400
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Fri Aug 2 16:24:15 2013 -0400

----------------------------------------------------------------------
 .../server/gc/GarbageCollectWriteAheadLogs.java |  1 +
 .../server/gc/SimpleGarbageCollector.java       | 35 +++++++++++++-------
 2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/af6c7e8d/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
index 6548339..7dba265 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
@@ -111,6 +111,7 @@ public class GarbageCollectWriteAheadLogs {
       
     } catch (Exception e) {
       log.error("exception occured while garbage collecting write ahead logs", e);
+    } finally {
       span.stop();
     }
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/af6c7e8d/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
index 45df0d4..118536f 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
@@ -213,17 +213,24 @@ public class SimpleGarbageCollector implements Iface {
         
         Span candidatesSpan = Trace.start("getCandidates");
         status.current.started = System.currentTimeMillis();
-        SortedSet<String> candidates = getCandidates();
-        status.current.candidates = candidates.size();
-        candidatesSpan.stop();
+        SortedSet<String> candidates;
+        try {
+          candidates = getCandidates();
+          status.current.candidates = candidates.size();
+        } finally {
+          candidatesSpan.stop();
+        }
         
         // STEP 2: confirm deletes
         // WARNING: This line is EXTREMELY IMPORTANT.
         // You MUST confirm candidates are okay to delete
         Span confirmDeletesSpan = Trace.start("confirmDeletes");
-        confirmDeletes(candidates);
+        try {
+          confirmDeletes(candidates);
         status.current.inUse = status.current.candidates - candidates.size();
-        confirmDeletesSpan.stop();
+        } finally {
+          confirmDeletesSpan.stop();
+        }
         
         // STEP 3: delete files
         if (opts.safeMode) {
@@ -239,12 +246,15 @@ public class SimpleGarbageCollector implements Iface {
           log.info("SAFEMODE: End candidates for deletion");
         } else {
           Span deleteSpan = Trace.start("deleteFiles");
-          deleteFiles(candidates);
-          log.info("Number of data file candidates for deletion: " + status.current.candidates);
-          log.info("Number of data file candidates still in use: " + status.current.inUse);
-          log.info("Number of successfully deleted data files: " + status.current.deleted);
-          log.info("Number of data files delete failures: " + status.current.errors);
-          deleteSpan.stop();
+          try {
+            deleteFiles(candidates);
+            log.info("Number of data file candidates for deletion: " + status.current.candidates);
+            log.info("Number of data file candidates still in use: " + status.current.inUse);
+            log.info("Number of successfully deleted data files: " + status.current.deleted);
+            log.info("Number of data files delete failures: " + status.current.errors);
+          } finally {
+            deleteSpan.stop();
+          }
           
           // delete empty dirs of deleted tables
           // this can occur as a result of cloning
@@ -277,8 +287,9 @@ public class SimpleGarbageCollector implements Iface {
         walogCollector.collect(status);
       } catch (Exception e) {
         log.error(e, e);
+      } finally {
+        waLogs.stop();
       }
-      waLogs.stop();
       gcSpan.stop();
       
       // we just made a lot of changes to the !METADATA table: flush them out


Mime
View raw message