[ 
https://issues.apache.org/jira/browse/HDDS-1638?focusedWorklogId=265818&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-265818
 ]

ASF GitHub Bot logged work on HDDS-1638:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Jun/19 16:55
            Start Date: 24/Jun/19 16:55
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on pull request #956: 
HDDS-1638.  Implement Key Write Requests to use Cache and DoubleBuffer.
URL: https://github.com/apache/hadoop/pull/956#discussion_r296819323
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMAllocateBlockResponse.java
 ##########
 @@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.response.key;
+
+import org.apache.hadoop.ozone.om.OMMetadataManager;
+import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
+import org.apache.hadoop.ozone.om.response.OMClientResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .OMResponse;
+import org.apache.hadoop.utils.db.BatchOperation;
+
+import java.io.IOException;
+
+/**
+ * Response for AllocateBlock request.
+ */
+public class OMAllocateBlockResponse extends OMClientResponse {
+
+  private final OmKeyInfo omKeyInfo;
+  private final long clientID;
+
+  public OMAllocateBlockResponse(OmKeyInfo omKeyInfo,
+      long clientID, OMResponse omResponse) {
+    super(omResponse);
+    this.omKeyInfo = omKeyInfo;
+    this.clientID = clientID;
+  }
+
+  @Override
+  public void addToDBBatch(OMMetadataManager omMetadataManager,
+      BatchOperation batchOperation) throws IOException {
+
+    // For OmResponse with failure, this should do nothing. This method is
+    // not called in failure scenario in OM code.
+    if (getOMResponse().getStatus() == OzoneManagerProtocolProtos.Status.OK) {
 
 Review comment:
   This is actually a safe guard check. As these now each request/response 
classes are independent. If some one in the future directly uses these classes 
(Don't know if someone will use them) to handle those cases added the check. 
Right now when OMResponse Status is OK, then only response is added to OM 
DoubleBuffer in OzoneManagerProtocolServerSideTranslatorPB.java. And this 
addToDbBatch will be called from OMDoubleBuffer. So, for now, even if someone 
in future who implements these classes forgot to add this check, we don't see 
any side affects.
 
----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 265818)
    Time Spent: 5h  (was: 4h 50m)

> Implement Key Write Requests to use Cache and DoubleBuffer
> ----------------------------------------------------------
>
>                 Key: HDDS-1638
>                 URL: https://issues.apache.org/jira/browse/HDDS-1638
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>          Components: Ozone Manager
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h
>  Remaining Estimate: 0h
>
> Implement Key write requests to use OM Cache, double buffer. 
> In this Jira will add the changes to implement key operations, and HA/Non-HA 
> will have a different code path, but once all requests are implemented will 
> have a single code path.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to