[
https://issues.apache.org/jira/browse/HDDS-1638?focusedWorklogId=264823&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-264823
]
ASF GitHub Bot logged work on HDDS-1638:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Jun/19 17:20
Start Date: 21/Jun/19 17:20
Worklog Time Spent: 10m
Work Description: hanishakoneru 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_r296041965
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
##########
@@ -495,12 +495,27 @@ public boolean isVolumeEmpty(String volume) throws
IOException {
public boolean isBucketEmpty(String volume, String bucket)
throws IOException {
String keyPrefix = getBucketKey(volume, bucket);
- //TODO: When Key ops are converted in to HA model, use cache also to
- // determine bucket is empty or not.
+
+ // First check in key table cache.
+ Iterator<Map.Entry<CacheKey<String>, CacheValue<OmKeyInfo>>> iterator =
+ ((TypedTable< String, OmKeyInfo>) keyTable).cacheIterator();
+ while (iterator.hasNext()) {
+ Map.Entry< CacheKey<String>, CacheValue<OmKeyInfo>> entry =
+ iterator.next();
+ String key = entry.getKey().getCacheKey();
+ OmKeyInfo omKeyInfo = entry.getValue().getCacheValue();
+ // Making sure that entry is not for delete key request.
+ if (key.startsWith(keyPrefix) && omKeyInfo != null) {
+ return false;
+ }
+ }
try (TableIterator<String, ? extends KeyValue<String, OmKeyInfo>> keyIter =
keyTable.iterator()) {
KeyValue<String, OmKeyInfo> kv = keyIter.seek(keyPrefix);
- if (kv != null && kv.getKey().startsWith(keyPrefix)) {
+ // During iteration from DB, check in mean time if this key is not
+ // marked for delete.
+ if (kv != null && kv.getKey().startsWith(keyPrefix) &&
+ keyTable.get(kv.getKey()) != null) {
Review comment:
The keyTable.get(.. ) checks the cache and if no entry is available in
cache, it gets from the DB. We can avoid the reading from the DB again here and
check the cache alone.
This is applicable for volumeEmpty check also but if we are going to
maintain a full bucket table cache then it does not matter.
----------------------------------------------------------------
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: 264823)
Time Spent: 3h 20m (was: 3h 10m)
> 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: 3h 20m
> 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]