[
https://issues.apache.org/jira/browse/HDDS-1551?focusedWorklogId=250623&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-250623
]
ASF GitHub Bot logged work on HDDS-1551:
----------------------------------------
Author: ASF GitHub Bot
Created on: 29/May/19 23:46
Start Date: 29/May/19 23:46
Worklog Time Spent: 10m
Work Description: hanishakoneru commented on pull request #850:
HDDS-1551. Implement Bucket Write Requests to use Cache and DoubleBuf…
URL: https://github.com/apache/hadoop/pull/850#discussion_r288727105
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/utils/OzoneManagerRatisUtils.java
##########
@@ -0,0 +1,74 @@
+/**
+ * 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.ratis.utils;
+
+import org.apache.hadoop.ozone.om.exceptions.OMException;
+import org.apache.hadoop.ozone.om.request.OMBucketCreateRequest;
+import org.apache.hadoop.ozone.om.request.OMBucketDeleteRequest;
+import org.apache.hadoop.ozone.om.request.OMBucketSetPropertyRequest;
+import org.apache.hadoop.ozone.om.request.OMClientRequest;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+ .OMRequest;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
+
+import java.io.IOException;
+
+/**
+ * Utility class used by OzoneManager HA.
+ */
+public final class OzoneManagerRatisUtils {
+
+ private OzoneManagerRatisUtils() {
+ }
+ /**
+ * Create OMClientRequest which enacpsulates the OMRequest.
+ * @param omRequest
+ * @return OMClientRequest
+ * @throws IOException
+ */
+ public static OMClientRequest createClientRequest(OMRequest omRequest)
+ throws IOException {
+ Type cmdType = omRequest.getCmdType();
+ switch (cmdType) {
+ case CreateBucket:
+ return new OMBucketCreateRequest(omRequest);
+ case DeleteBucket:
+ return new OMBucketDeleteRequest(omRequest);
+ case SetBucketProperty:
+ return new OMBucketSetPropertyRequest(omRequest);
+ default:
+ // TODO: will update once all request types are implemented.
+ return null;
+ }
+ }
+
+ /**
+ * Convert exception result to {@link OzoneManagerProtocolProtos.Status}.
+ * @param exception
+ * @return {@link OzoneManagerProtocolProtos.Status}
+ */
+ public static Status exceptionToResponseStatus(IOException exception) {
+ if (exception instanceof OMException) {
+ return Status.values()[((OMException) exception).getResult().ordinal()];
Review comment:
Should it not be Status.valueOf()? Or does this also give the same result?
----------------------------------------------------------------
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: 250623)
Time Spent: 5h 40m (was: 5.5h)
> Implement Bucket Write Requests to use Cache and DoubleBuffer
> -------------------------------------------------------------
>
> Key: HDDS-1551
> URL: https://issues.apache.org/jira/browse/HDDS-1551
> 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 40m
> Remaining Estimate: 0h
>
> Implement Bucket write requests to use OM Cache, double buffer.
> And also in OM previously we used to Ratis client for communication to Ratis
> server, instead of that use Ratis server API's.
>
> In this Jira will add the changes to implement bucket 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]