private void closeCurrentLogStream(boolean abort) { if (stream == null || logs.isEmpty()) { return; } try { ProcedureWALFile log = logs.getLast(); // If the loading flag is true, it usually means that we fail when loading procedures, so we // should not persist the store tracker, as its state may not be correct. if (!loading.get()) { log.setProcIds(storeTracker.getModifiedMinProcId(), storeTracker.getModifiedMaxProcId()); log.updateLocalTracker(storeTracker); if (!abort) { long trailerSize = ProcedureWALFormat.writeTrailer(stream, storeTracker); log.addToSize(trailerSize); } } } catch (IOException e) { LOG.warn("Unable to write the trailer", e); } try { stream.close(); } catch (IOException e) { LOG.error("Unable to close the stream", e); } stream = null; }
private void closeCurrentLogStream() { if (stream == null || logs.isEmpty()) { return; } try { ProcedureWALFile log = logs.getLast(); log.setProcIds(storeTracker.getUpdatedMinProcId(), storeTracker.getUpdatedMaxProcId()); log.updateLocalTracker(storeTracker); long trailerSize = ProcedureWALFormat.writeTrailer(stream, storeTracker); log.addToSize(trailerSize); } catch (IOException e) { LOG.warn("Unable to write the trailer: " + e.getMessage()); } try { stream.close(); } catch (IOException e) { LOG.error("Unable to close the stream", e); } stream = null; }
private void closeCurrentLogStream(boolean abort) { if (stream == null || logs.isEmpty()) { return; } try { ProcedureWALFile log = logs.getLast(); // If the loading flag is true, it usually means that we fail when loading procedures, so we // should not persist the store tracker, as its state may not be correct. if (!loading.get()) { log.setProcIds(storeTracker.getModifiedMinProcId(), storeTracker.getModifiedMaxProcId()); log.updateLocalTracker(storeTracker); if (!abort) { long trailerSize = ProcedureWALFormat.writeTrailer(stream, storeTracker); log.addToSize(trailerSize); } } } catch (IOException e) { LOG.warn("Unable to write the trailer", e); } try { stream.close(); } catch (IOException e) { LOG.error("Unable to close the stream", e); } stream = null; }