You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/05/10 23:05:48 UTC

[02/19] accumulo git commit: Revert "ACCUMULO-3775 always sync the OPEN record"

Revert "ACCUMULO-3775 always sync the OPEN record"

This reverts commit 931bf897e337756a26064039ca86b848fec556bc.

Conflicts:
	server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java


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

Branch: refs/heads/master
Commit: 6b6b30ae348ce0e6894b268236183e8d7033ebb2
Parents: 31dd5ca
Author: Josh Elser <el...@apache.org>
Authored: Sat May 9 14:39:22 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat May 9 14:39:22 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/tserver/log/DfsLogger.java  | 14 ++-------
 .../tserver/log/TabletServerLogger.java         | 32 +++-----------------
 2 files changed, 6 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/6b6b30ae/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index 397eeff..cd7ce08 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -369,14 +369,6 @@ public class DfsLogger implements Comparable<DfsLogger> {
     return new DFSLoggerInputStreams(input, decryptingInput);
   }
 
-  /**
-   * Opens a Write-Ahead Log file and writes the necessary header information and OPEN entry to the file. The file is ready to be used for ingest if this method
-   * returns successfully. If an exception is thrown from this method, it is the callers responsibility to ensure that {@link #close()} is called to prevent
-   * leaking the file handle and/or syncing thread.
-   *
-   * @param address
-   *          The address of the host using this WAL
-   */
   public synchronized void open(String address) throws IOException {
     String filename = UUID.randomUUID().toString();
     log.debug("Address is " + address);
@@ -389,7 +381,6 @@ public class DfsLogger implements Comparable<DfsLogger> {
         + Path.SEPARATOR + filename;
 
     metaReference = toString();
-    LoggerOperation op = null;
     try {
       short replication = (short) conf.getConfiguration().getCount(Property.TSERV_WAL_REPLICATION);
       if (replication == 0)
@@ -439,7 +430,8 @@ public class DfsLogger implements Comparable<DfsLogger> {
       key.event = OPEN;
       key.tserverSession = filename;
       key.filename = filename;
-      op = logFileData(Collections.singletonList(new Pair<>(key, EMPTY)), Durability.SYNC);
+      write(key, EMPTY);
+      log.debug("Got new write-ahead log: " + this);
     } catch (Exception ex) {
       if (logFile != null)
         logFile.close();
@@ -451,8 +443,6 @@ public class DfsLogger implements Comparable<DfsLogger> {
     syncThread = new Daemon(new LoggingRunnable(log, new LogSyncingTask()));
     syncThread.setName("Accumulo WALog thread " + toString());
     syncThread.start();
-    op.await();
-    log.debug("Got new write-ahead log: " + this);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6b6b30ae/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index 809c56a..3fb3c86 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -52,7 +52,6 @@ import org.apache.accumulo.tserver.Mutations;
 import org.apache.accumulo.tserver.TabletMutations;
 import org.apache.accumulo.tserver.TabletServer;
 import org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation;
-import org.apache.accumulo.tserver.log.DfsLogger.ServerResources;
 import org.apache.accumulo.tserver.tablet.CommitSession;
 import org.apache.hadoop.fs.Path;
 import org.slf4j.Logger;
@@ -238,40 +237,17 @@ public class TabletServerLogger {
     nextLogMaker.submit(new Runnable() {
       @Override
       public void run() {
-        final ServerResources conf = tserver.getServerConfig();
-        final VolumeManager fs = conf.getFileSystem();
         while (!nextLogMaker.isShutdown()) {
-          DfsLogger alog = null;
           try {
             log.debug("Creating next WAL");
-            alog = new DfsLogger(conf, syncCounter, flushCounter);
+            DfsLogger alog = new DfsLogger(tserver.getServerConfig(), syncCounter, flushCounter);
             alog.open(tserver.getClientAddressString());
-            String fileName = alog.getFileName();
-            log.debug("Created next WAL " + fileName);
+            log.debug("Created next WAL " + alog.getFileName());
             while (!nextLog.offer(alog, 12, TimeUnit.HOURS)) {
-              log.info("Our WAL was not used for 12 hours: " + fileName);
+              log.info("Our WAL was not used for 12 hours: " + alog.getFileName());
             }
           } catch (Exception t) {
-            log.error("Failed to open WAL", t);
-            if (null != alog) {
-              // It's possible that the sync of the header and OPEN record to the WAL failed
-              // We want to make sure that clean up the resources/thread inside the DfsLogger
-              // object before trying to create a new one.
-              try {
-                alog.close();
-              } catch (IOException e) {
-                log.error("Failed to close WAL after it failed to open", e);
-              }
-              // Try to avoid leaving a bunch of empty WALs lying around
-              try {
-                Path path = alog.getPath();
-                if (fs.exists(path)) {
-                  fs.delete(path);
-                }
-              } catch (IOException e) {
-                log.warn("Failed to delete a WAL that failed to open", e);
-              }
-            }
+            log.error("{}", t.getMessage(), t);
             try {
               nextLog.offer(t, 12, TimeUnit.HOURS);
             } catch (InterruptedException ex) {