keith-turner commented on a change in pull request #369: [ACCUMULO-4787] Close input stream in AccumuloReplicaSystem URL: https://github.com/apache/accumulo/pull/369#discussion_r167660400
########## 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: Would be nice to open an issue for follow up work. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services