[
https://issues.apache.org/jira/browse/HDFS-11781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034850#comment-16034850
]
Weiwei Yang edited comment on HDFS-11781 at 6/2/17 3:17 PM:
------------------------------------------------------------
Hi [~yuanbo]
Thanks for the update. But the modification you did for {{BlockManager}} seems
wrong,
{code}
AllocatedBlock allocateBlock(long size, String blockKey) throws IOException;
{code}
according to the API spec defined in HDFS-11504. {{allocateBlock}} is supposed
to generate a {{blockID}} while allocating a new block, and store that SCM DB.
This key is not the {{objectKey}}. KSM maintains a {{KsmKeyInfo}} for each
{{objectKey}} in its DB, it has a field to retrieve the {{blockID}} for a given
{{objectKey}}, you can use that to query SCM for block locations.
So
{code}
Set<String> keys = new HashSet<>();
keys.add(objectKeyStr);
List<DeleteBlockResult> resultList = scmBlockClient.deleteBlocks(keys);
{code}
can be modified to something like
{code}
KsmKeyInfo keyInfo = lookupKey(ksmKeyArgs);
String bockID = keyInfo.getBlockID();
List<DeleteBlockResult> resultList =
scmBlockClient.deleteBlocks(Collections.singleton(bockID));
{code}
Let me know if this makes sense. Thanks
was (Author: cheersyang):
Hi [~yuanbo]
Thanks for the update. But the modification you did for {{BlockManager}} seems
wrong,
{code}
AllocatedBlock allocateBlock(long size, String blockKey) throws IOException;
{code}
according to the API spec defined in HDFS-11504. {{allocateBlock}} is supposed
to generate a {{blockID}} while allocating a new block, and store that SCM DB.
This key is not the {{objectKey}}. KSM maintains a {{KsmKeyInfo}} for each
{{objectKey}} in its DB, it has a field to retrieve the {{blockID}} for a given
{{objectKey}}, you can use that to query SCM for block locations.
So
{code}
Set<String> keys = new HashSet<>();
keys.add(objectKeyStr);
List<DeleteBlockResult> resultList = scmBlockClient.deleteBlocks(keys);
{code}
can be modified to something like
{code}
KsmKeyInfo keyInfo = lookupKey(ksmKeyArgs);
String bockID = keyInfo.getBlockID
List<DeleteBlockResult> resultList =
scmBlockClient.deleteBlocks(Collections.singleton(bockID));
{code}
Let me know if this makes sense. Thanks
> Ozone: KSM: Add deleteKey
> -------------------------
>
> Key: HDFS-11781
> URL: https://issues.apache.org/jira/browse/HDFS-11781
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: ozone
> Affects Versions: HDFS-7240
> Reporter: Anu Engineer
> Assignee: Yuanbo Liu
> Attachments: HDFS-11781-HDFS-7240.001.patch,
> HDFS-11781-HDFS-7240.002.patch, HDFS-11781-HDFS-7240.003.patch
>
>
> Add support for removing a key.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]