From common-issues-return-168779-apmail-hadoop-common-issues-archive=hadoop.apache.org@hadoop.apache.org Thu Mar 28 17:48:45 2019 Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4E99187A4 for ; Thu, 28 Mar 2019 17:48:45 +0000 (UTC) Received: (qmail 44846 invoked by uid 500); 28 Mar 2019 17:48:44 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 44735 invoked by uid 500); 28 Mar 2019 17:48:44 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 44397 invoked by uid 99); 28 Mar 2019 17:48:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Mar 2019 17:48:44 +0000 From: GitBox To: common-issues@hadoop.apache.org Subject: [GitHub] [hadoop] bharatviswa504 commented on a change in pull request #651: HDDS-1339. Implement ratis snapshots on OM Message-ID: <155379532414.29136.5161546091885848792.gitbox@gitbox.apache.org> Date: Thu, 28 Mar 2019 17:48:44 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit bharatviswa504 commented on a change in pull request #651: HDDS-1339. Implement ratis snapshots on OM URL: https://github.com/apache/hadoop/pull/651#discussion_r270122895 ########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java ########## @@ -308,56 +357,35 @@ private IOException constructExceptionForFailedRequest( STATUS_CODE + omResponse.getStatus()); } - /* - * Apply a committed log entry to the state machine. - */ - @Override - public CompletableFuture applyTransaction(TransactionContext trx) { - try { - OMRequest request = OMRatisHelper.convertByteStringToOMRequest( - trx.getStateMachineLogEntry().getLogData()); - CompletableFuture future = CompletableFuture - .supplyAsync(() -> runCommand(request)); - return future; - } catch (IOException e) { - return completeExceptionally(e); - } - } - /** - * Query the state machine. The request must be read-only. + * Submits write request to OM and returns the response Message. + * @param request OMRequest + * @return response from OM + * @throws ServiceException */ - @Override - public CompletableFuture query(Message request) { - try { - OMRequest omRequest = OMRatisHelper.convertByteStringToOMRequest( - request.getContent()); - return CompletableFuture.completedFuture(runCommand(omRequest)); - } catch (IOException e) { - return completeExceptionally(e); + private Message runCommand(OMRequest request, long trxLogIndex) { + OMResponse response = handler.handle(request); + if (response.getSuccess()) { Review comment: Why we have checked getSuccess here, then considered that as lastAppliedIndex. As when there are cases like bucket creation failed for an already existing bucket, the success will be set false. But that transaction request is successfully completed. This one also should be considered as applied only right?(Even though it does not mutate om DB, but the transaction request has been completed) ---------------------------------------------------------------- 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