You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "aswinshakil (via GitHub)" <gi...@apache.org> on 2023/03/01 17:11:53 UTC
[GitHub] [ozone] aswinshakil opened a new pull request, #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
aswinshakil opened a new pull request, #4333:
URL: https://github.com/apache/ozone/pull/4333
## What changes were proposed in this pull request?
When keys are renamed in between snapshots, it is inefficient to find the renamed keys in the previous snapshot `keyTable`, This is because the `TableKey` for the renamed key has changed and it becomes impossible to find if the renamed key existed in the previous snapshot's `keyTable` since there is no way to index the keys with respect to objectID.
This patch proposes to add a new column family `renamedKeyTable` (objectID --> RenamedKeys) to store this information.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-7984
## How was this patch tested?
The patch was tested using Unit tests and CI
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123853665
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java:
##########
@@ -482,6 +485,18 @@ default String getOzonePathKey(long volumeId, long bucketId,
String getOpenFileName(long volumeId, long bucketId,
long parentObjectId, String fileName, long id);
+
+ /**
+ * Given a volume, bucket and a objectID, return the corresponding DB rename
+ * key.
Review Comment:
```suggestion
* Given a volume, bucket and a objectID, return the DB key name in
* renamedKeyTable.
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123845837
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/snapshot/OMSnapshotCreateResponse.java:
##########
@@ -68,5 +74,25 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
// Add to db
omMetadataManager.getSnapshotInfoTable().putWithBatch(batchOperation,
key, snapshotInfo);
+
+ // TODO: [SNAPSHOT] Move to createOmSnapshotCheckpoint and add table lock
+ // Remove all entries from renamedKeyTable
+ TableIterator<String, ? extends Table.KeyValue<String, OmKeyRenameInfo>>
+ iterator = omMetadataManager.getRenamedKeyTable().iterator();
+
+ String dbSnapshotBucketKey = omMetadataManager.getBucketKey(
+ snapshotInfo.getVolumeName(), snapshotInfo.getBucketName())
+ + OM_KEY_PREFIX;
+ iterator.seek(dbSnapshotBucketKey);
+
+ while (iterator.hasNext()) {
+ String renameDbKey = iterator.next().getKey();
+ if (!renameDbKey.contains(dbSnapshotBucketKey)) {
Review Comment:
Should use `startsWith` ?
```suggestion
if (!renameDbKey.startsWith(dbSnapshotBucketKey)) {
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123854869
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -622,6 +630,11 @@ protected void initializeOmTables(boolean addCacheMetrics)
String.class, SnapshotInfo.class);
checkTableStatus(snapshotInfoTable, SNAPSHOT_INFO_TABLE, addCacheMetrics);
+ // objectID -> renamedKeys (renamed keys for key table)
+ renamedKeyTable = this.store.getTable(RENAMED_KEY_TABLE,
+ String.class, OmKeyRenameInfo.class);
+ checkTableStatus(renamedKeyTable, RENAMED_KEY_TABLE, addCacheMetrics);
+
Review Comment:
TODO in the follow-up jira: Add table lock for `renamedKeyTable`.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -622,6 +630,11 @@ protected void initializeOmTables(boolean addCacheMetrics)
String.class, SnapshotInfo.class);
checkTableStatus(snapshotInfoTable, SNAPSHOT_INFO_TABLE, addCacheMetrics);
+ // objectID -> renamedKeys (renamed keys for key table)
+ renamedKeyTable = this.store.getTable(RENAMED_KEY_TABLE,
+ String.class, OmKeyRenameInfo.class);
+ checkTableStatus(renamedKeyTable, RENAMED_KEY_TABLE, addCacheMetrics);
+
Review Comment:
TODO in the follow-up jira: Add table lock for `renamedKeyTable` here.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -622,6 +630,11 @@ protected void initializeOmTables(boolean addCacheMetrics)
String.class, SnapshotInfo.class);
checkTableStatus(snapshotInfoTable, SNAPSHOT_INFO_TABLE, addCacheMetrics);
+ // objectID -> renamedKeys (renamed keys for key table)
+ renamedKeyTable = this.store.getTable(RENAMED_KEY_TABLE,
+ String.class, OmKeyRenameInfo.class);
+ checkTableStatus(renamedKeyTable, RENAMED_KEY_TABLE, addCacheMetrics);
+
Review Comment:
TODO in the follow-up jira: init table lock for `renamedKeyTable` here.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122473092
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -193,6 +195,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
* |----------------------------------------------------------------------|
* | snapshotInfoTable | /volume/bucket/snapshotName -> SnapshotInfo |
* |----------------------------------------------------------------------|
+ * | renamedKeyTable | objectID -> RepeatedString |
Review Comment:
Locking will be done in the follow-up jira that actually uses this table in SDT and KDT
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123858490
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyRenameResponse.java:
##########
@@ -73,13 +75,26 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
BatchOperation batchOperation) throws IOException {
String volumeName = renameKeyInfo.getVolumeName();
String bucketName = renameKeyInfo.getBucketName();
+ String fromDbKey = omMetadataManager
+ .getOzoneKey(volumeName, bucketName, fromKeyName);
omMetadataManager.getKeyTable(getBucketLayout())
- .deleteWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
+ .deleteWithBatch(batchOperation, fromDbKey);
omMetadataManager.getKeyTable(getBucketLayout())
.putWithBatch(batchOperation,
omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
renameKeyInfo);
+
+ String renameDbKey = omMetadataManager.getRenameKey(
+ renameKeyInfo.getVolumeName(), renameKeyInfo.getBucketName(),
+ renameKeyInfo.getObjectID());
+ OmKeyRenameInfo omKeyRenameInfo = omMetadataManager.getRenamedKeyTable()
+ .get(renameDbKey);
+ if (omKeyRenameInfo == null) {
+ omKeyRenameInfo = new OmKeyRenameInfo(fromDbKey);
+ omMetadataManager.getRenamedKeyTable().putWithBatch(
+ batchOperation, renameDbKey, omKeyRenameInfo);
+ }
Review Comment:
This means we are actually only storing the Ozone key's original name correct?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl merged pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #4333:
URL: https://github.com/apache/ozone/pull/4333
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122562145
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/snapshot/OMSnapshotCreateResponse.java:
##########
@@ -68,5 +73,16 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
// Add to db
omMetadataManager.getSnapshotInfoTable().putWithBatch(batchOperation,
key, snapshotInfo);
+
+ // Remove all entries from renamedKeyTable
+ TableIterator<Long, ? extends Table.KeyValue<Long, RepeatedOmString>>
+ iterator = omMetadataManager.getRenamedKeyTable().iterator();
+
+ while (iterator.hasNext()) {
+ Long objectID = iterator.next().getKey();
+ omMetadataManager.getRenamedKeyTable()
+ .deleteWithBatch(batchOperation, objectID);
+ }
Review Comment:
This should be done inside `createOmSnapshotCheckpoint` with lock held like in #4280 . For this PR you can put a TODO here since the other PR is not merged yet (which has the locking and deleteRange implementation).
And it should only remove entries in the snapshot scope in `renamedKeyTable`, similar to `deletedTable`.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122562145
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/snapshot/OMSnapshotCreateResponse.java:
##########
@@ -68,5 +73,16 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
// Add to db
omMetadataManager.getSnapshotInfoTable().putWithBatch(batchOperation,
key, snapshotInfo);
+
+ // Remove all entries from renamedKeyTable
+ TableIterator<Long, ? extends Table.KeyValue<Long, RepeatedOmString>>
+ iterator = omMetadataManager.getRenamedKeyTable().iterator();
+
+ while (iterator.hasNext()) {
+ Long objectID = iterator.next().getKey();
+ omMetadataManager.getRenamedKeyTable()
+ .deleteWithBatch(batchOperation, objectID);
+ }
Review Comment:
This should be done in `createOmSnapshotCheckpoint` like in #4280 . For this PR you can put a TODO here since the other PR is not merged yet (which has the locking and deleteRange implementation).
And it should only remove entries in the snapshot scope in `renamedKeyTable`, similar to `deletedTable`.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122473837
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -193,6 +195,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
* |----------------------------------------------------------------------|
* | snapshotInfoTable | /volume/bucket/snapshotName -> SnapshotInfo |
* |----------------------------------------------------------------------|
+ * | renamedKeyTable | objectID -> RepeatedString |
Review Comment:
In order for efficient table cleanup when creating a snapshot, we need a slight improvement here that appends the volume and bucket name before the key object ID.
```suggestion
* | renamedKeyTable | /volumeName/bucketName/objectID -> OmKeyRenameInfo |
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123825566
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyRenameInfo.java:
##########
@@ -0,0 +1,91 @@
+/**
+ * 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.helpers;
+
+
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RepeatedString;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Argument for renamedKeyTable. Helps to store List<String> which represents
+ * all the renames that happened to particular key in between snapshots.
+ */
+public class OmKeyRenameInfo {
+ private List<String> omKeyRenameInfoList;
Review Comment:
```suggestion
private List<String> keyNamesList;
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123822685
##########
hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto:
##########
@@ -1028,6 +1028,10 @@ message RepeatedKeyInfo {
repeated KeyInfo keyInfo = 1;
}
+message RepeatedString {
+ repeated string keyName = 1;
Review Comment:
Ah I should have pointed out that this also needs to be specific.
```suggestion
message KeyRenameInfo {
repeated string keyNames = 1;
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122470648
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmString.java:
##########
@@ -0,0 +1,91 @@
+/**
+ * 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.helpers;
+
+
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RepeatedString;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Argument for renamedKeyTable. Helps to store List<String> which represents
+ * all the renames that happened to particular key in between snapshots.
+ */
+public class RepeatedOmString {
Review Comment:
Since this the value for `renameKeyTable`, we can name this `OmKeyRenameInfo`.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122334402
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -193,6 +195,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
* |----------------------------------------------------------------------|
* | snapshotInfoTable | /volume/bucket/snapshotName -> SnapshotInfo |
* |----------------------------------------------------------------------|
+ * | renamedKeyTable | objectID -> RepeatedString |
Review Comment:
We need to store only the last rename that will get captured in the 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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] aswinshakil commented on pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "aswinshakil (via GitHub)" <gi...@apache.org>.
aswinshakil commented on PR #4333:
URL: https://github.com/apache/ozone/pull/4333#issuecomment-1452390377
Thanks @smengcl and @prashantpogde, I have updated the PR with the suggestions. Please take a look at it.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] aswinshakil commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "aswinshakil (via GitHub)" <gi...@apache.org>.
aswinshakil commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123861669
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyRenameResponse.java:
##########
@@ -73,13 +75,26 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
BatchOperation batchOperation) throws IOException {
String volumeName = renameKeyInfo.getVolumeName();
String bucketName = renameKeyInfo.getBucketName();
+ String fromDbKey = omMetadataManager
+ .getOzoneKey(volumeName, bucketName, fromKeyName);
omMetadataManager.getKeyTable(getBucketLayout())
- .deleteWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
+ .deleteWithBatch(batchOperation, fromDbKey);
omMetadataManager.getKeyTable(getBucketLayout())
.putWithBatch(batchOperation,
omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
renameKeyInfo);
+
+ String renameDbKey = omMetadataManager.getRenameKey(
+ renameKeyInfo.getVolumeName(), renameKeyInfo.getBucketName(),
+ renameKeyInfo.getObjectID());
+ OmKeyRenameInfo omKeyRenameInfo = omMetadataManager.getRenamedKeyTable()
+ .get(renameDbKey);
+ if (omKeyRenameInfo == null) {
+ omKeyRenameInfo = new OmKeyRenameInfo(fromDbKey);
+ omMetadataManager.getRenamedKeyTable().putWithBatch(
+ batchOperation, renameDbKey, omKeyRenameInfo);
+ }
Review Comment:
Yes correct, We only need the original key name. In between key renames are not necessary. But keeping this to store `OmKeyRenameInfo` instead single `String`, so we can expand on it further if needed.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122472169
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/codec/RepeatedOmStringCodec.java:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.codec;
+
+import com.google.common.base.Preconditions;
+import com.google.protobuf.InvalidProtocolBufferException;
+import org.apache.hadoop.hdds.utils.db.Codec;
+import org.apache.hadoop.ozone.om.helpers.RepeatedOmString;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RepeatedString;
+
+import java.io.IOException;
+
+/**
+ * Codec to encode RepeatedOmString as byte array.
+ */
+public class RepeatedOmStringCodec implements Codec<RepeatedOmString> {
Review Comment:
```suggestion
* Codec to encode OmKeyRenameInfo as byte array.
*/
public class OmKeyRenameInfoCodec implements Codec<OmKeyRenameInfo> {
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122564544
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/snapshot/TestOMSnapshotCreateRequest.java:
##########
@@ -238,6 +247,50 @@ public void testValidateAndUpdateCache() throws Exception {
omResponse.getStatus());
}
+ @Test
Review Comment:
If you temporarily remove the logic in `OMSnapshotCreateResponse` you can add `@Ignore` to this UT so that it is not executed. Add a TODO here as well.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] aswinshakil commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "aswinshakil (via GitHub)" <gi...@apache.org>.
aswinshakil commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123533189
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/snapshot/TestOMSnapshotCreateRequest.java:
##########
@@ -238,6 +247,50 @@ public void testValidateAndUpdateCache() throws Exception {
omResponse.getStatus());
}
+ @Test
Review Comment:
I'll keep the logic here for now and move it once locking patch is merged.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122467393
##########
hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto:
##########
@@ -1027,6 +1027,9 @@ message DirectoryInfo {
message RepeatedKeyInfo {
repeated KeyInfo keyInfo = 1;
}
+message RepeatedString {
Review Comment:
```suggestion
message RepeatedString {
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4333: HDDS-7984. [Snapshot] Store Ozone keys ever renamed in renamedKeyTable for efficient lookup in SnapshotDeletingService
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1122334129
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -193,6 +195,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
* |----------------------------------------------------------------------|
* | snapshotInfoTable | /volume/bucket/snapshotName -> SnapshotInfo |
* |----------------------------------------------------------------------|
+ * | renamedKeyTable | objectID -> RepeatedString |
Review Comment:
We need to also make sure that during snapshot creates, we block renames.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org