hanishakoneru commented on a change in pull request #651: HDDS-1339. Implement ratis snapshots on OM URL: https://github.com/apache/hadoop/pull/651#discussion_r270237034 ########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java ########## @@ -115,7 +117,60 @@ public TransactionContext startTransaction( return ctxt; } return handleStartTransactionRequests(raftClientRequest, omRequest); + } + + /* + * Apply a committed log entry to the state machine. + */ + @Override + public CompletableFuture applyTransaction(TransactionContext trx) { + try { + OMRequest request = OMRatisHelper.convertByteStringToOMRequest( + trx.getStateMachineLogEntry().getLogData()); + long trxLogIndex = trx.getLogEntry().getIndex(); + CompletableFuture future = CompletableFuture + .supplyAsync(() -> runCommand(request, trxLogIndex)); + return future; + } catch (IOException e) { + return completeExceptionally(e); + } + } + + /** + * Query the state machine. The request must be read-only. + */ + @Override + public CompletableFuture query(Message request) { + try { + OMRequest omRequest = OMRatisHelper.convertByteStringToOMRequest( + request.getContent()); + return CompletableFuture.completedFuture(queryCommand(omRequest)); + } catch (IOException e) { + return completeExceptionally(e); + } + } + + /** + * Take OM Ratis snapshot. Write the snapshot index to file. Snapshot index + * is the log index corresponding to the last applied transaction on the OM + * State Machine. + * + * @return the last applied index on the state machine which has been + * stored in the snapshot file. + */ + @Override + public long takeSnapshot() throws IOException { + LOG.info("Saving Ratis snapshot on the OM."); + return ozoneManager.saveRatisSnapshot(); Review comment: done. flushing the DB before saving a snapshot. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to 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 --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org