accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] adamjshook commented on a change in pull request #369: [ACCUMULO-4787] Close input stream in AccumuloReplicaSystem
Date Thu, 01 Jan 1970 00:00:00 GMT
adamjshook commented on a change in pull request #369: [ACCUMULO-4787] Close input stream in
AccumuloReplicaSystem
URL: https://github.com/apache/accumulo/pull/369#discussion_r167651645
 
 

 ##########
 File path: server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
 ##########
 @@ -370,11 +368,112 @@ protected Status replicateLogs(ClientContext peerContext, final HostAndPort
peer
 
     log.debug("Replication WAL to peer tserver");
     final Set<Integer> tids;
-    final DataInputStream input;
-    Span span = Trace.start("Read WAL header");
-    span.data("file", p.toString());
-    try {
-      input = getWalStream(p);
+    try (final FSDataInputStream fsinput = fs.open(p); final DataInputStream input = getWalStream(p,
fsinput)) {
+      log.debug("Skipping unwanted data in WAL");
+      Span span = Trace.start("Consume WAL prefix");
+      span.data("file", p.toString());
+      try {
+        // We want to read all records in the WAL up to the "begin" offset contained in the
Status message,
+        // building a Set of tids from DEFINE_TABLET events which correspond to table ids
for future mutations
+        tids = consumeWalPrefix(target, input, p, status, sizeLimit);
+      } catch (IOException e) {
+        log.warn("Unexpected error consuming file.");
+        return status;
+      } finally {
+        span.stop();
+      }
+
+      log.debug("Sending batches of data to peer tserver");
 
 Review comment:
   Yeah, it's a little nasty.  These are all indentation changes with the addition of the
`try-catch`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message