hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HDDS-1620) Implement Volume Write Requests to use Cache and DoubleBuffer
Date Tue, 11 Jun 2019 22:03:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 11/Jun/19 22:02
            Start Date: 11/Jun/19 22:02
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on pull request #884: HDDS-1620. Implement
Volume Write Requests to use Cache and DoubleBuffer.
URL: https://github.com/apache/hadoop/pull/884#discussion_r292678083
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeCreateRequest.java
 ##########
 @@ -0,0 +1,209 @@
+/**
+ * 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.request.volume;
+
+import java.io.IOException;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.ozone.audit.AuditLogger;
+import org.apache.hadoop.ozone.audit.OMAction;
+import org.apache.hadoop.ozone.om.response.volume.OMVolumeCreateResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
+import org.apache.hadoop.utils.db.cache.CacheKey;
+import org.apache.hadoop.utils.db.cache.CacheValue;
+import org.apache.hadoop.ozone.om.OMMetrics;
+import org.apache.hadoop.ozone.om.OMMetadataManager;
+import org.apache.hadoop.ozone.om.OzoneManager;
+import org.apache.hadoop.ozone.om.exceptions.OMException;
+import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
+import org.apache.hadoop.ozone.om.request.OMClientRequest;
+import org.apache.hadoop.ozone.om.response.OMClientResponse;
+import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer;
+import org.apache.hadoop.ozone.security.acl.OzoneObj;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .CreateVolumeRequest;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .CreateVolumeResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .OMRequest;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .OMResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .VolumeInfo;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .VolumeList;
+import org.apache.hadoop.util.Time;
+
+/**
+ * Handles volume create request.
+ */
+public class OMVolumeCreateRequest extends OMClientRequest {
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OMVolumeCreateRequest.class);
+
+  public OMVolumeCreateRequest(OMRequest omRequest) {
+    super(omRequest);
+  }
+
+  @Override
+  public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+
+    VolumeInfo volumeInfo  =
+        getOmRequest().getCreateVolumeRequest().getVolumeInfo();
+
+    // Set creation time
+    VolumeInfo updatedVolumeInfo =
+        volumeInfo.toBuilder().setCreationTime(Time.now()).build();
+
+    // Update the OmRequest and then return it.
+    setUpdatedOmRequest(getOmRequest().toBuilder().setCreateVolumeRequest(
+        CreateVolumeRequest.newBuilder().setVolumeInfo(updatedVolumeInfo))
+        .setUserInfo(getUserInfo())
+        .build());
+
+    return getOmRequest();
+
+  }
+
+  @Override
+  public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
+      long transactionLogIndex) {
+
+    CreateVolumeRequest createVolumeRequest =
+        getOmRequest().getCreateVolumeRequest();
+    Preconditions.checkNotNull(createVolumeRequest);
+    VolumeInfo volumeInfo = createVolumeRequest.getVolumeInfo();
+
+    OMMetrics omMetrics = ozoneManager.getMetrics();
+    omMetrics.incNumVolumeCreates();
+
+    String volume = volumeInfo.getVolume();
+    String owner = volumeInfo.getOwnerName();
+
+    OMResponse.Builder omResponse = OMResponse.newBuilder().setCmdType(
+        OzoneManagerProtocolProtos.Type.CreateVolume).setStatus(
+        OzoneManagerProtocolProtos.Status.OK).setSuccess(true);
+
+    OmVolumeArgs omVolumeArgs = null;
+
+    OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
+
+    AuditLogger auditLogger = ozoneManager.getAuditLogger();
+    OzoneManagerProtocolProtos.UserInfo userInfo = getOmRequest().getUserInfo();
+
+    // Doing this here, so we can do protobuf conversion outside of lock.
+    try {
+      omVolumeArgs = OmVolumeArgs.getFromProtobuf(volumeInfo);
+    } catch (OMException ex) {
+      omMetrics.incNumVolumeCreateFails();
+      auditLog(auditLogger, buildAuditMessage(OMAction.CREATE_VOLUME,
+          buildVolumeAuditMap(volume), ex, userInfo));
+      LOG.error("Volume creation failed for user:{} volume:{}", owner, volume,
+          ex);
+      return new OMVolumeCreateResponse(omVolumeArgs, null,
+          createErrorOMResponse(omResponse, ex));
+    }
+
+
+
+    try {
+      // check Acl
+      if (ozoneManager.getAclsEnabled()) {
+        checkAcls(ozoneManager, OzoneObj.ResourceType.VOLUME,
+            OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.CREATE, volume,
+            null, null);
+      }
+    } catch (IOException ex) {
+      LOG.error("Volume creation failed for user:{} volume:{}", owner, volume,
+          ex);
+      omMetrics.incNumVolumeCreateFails();
+      auditLog(auditLogger, buildAuditMessage(OMAction.CREATE_VOLUME,
+          omVolumeArgs.toAuditMap(), ex, userInfo));
+      return new OMVolumeCreateResponse(omVolumeArgs, null,
+          createErrorOMResponse(omResponse, ex));
+    }
+
+
+
+    String dbUserKey = omMetadataManager.getUserKey(owner);
+    String dbVolumeKey = omMetadataManager.getVolumeKey(volume);
+    VolumeList volumeList = null;
+
+    // acquire lock.
+    omMetadataManager.getLock().acquireUserLock(owner);
+    omMetadataManager.getLock().acquireVolumeLock(volume);
+
+    IOException exception = null;
+    try {
+      OmVolumeArgs dbVolumeArgs =
+          omMetadataManager.getVolumeTable().get(dbVolumeKey);
+
+      // Validation: Check of the volume already exists
 
 Review comment:
   Done
 
----------------------------------------------------------------
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


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

    Worklog Id:     (was: 258160)
    Time Spent: 8h 20m  (was: 8h 10m)

> Implement Volume Write Requests to use Cache and DoubleBuffer
> -------------------------------------------------------------
>
>                 Key: HDDS-1620
>                 URL: https://issues.apache.org/jira/browse/HDDS-1620
>             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: 8h 20m
>  Remaining Estimate: 0h
>
> Implement Volume write requests to use OM Cache, double buffer. 
> In this Jira will add the changes to implement volume 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: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message