hanishakoneru commented on a change in pull request #884: HDDS-1620. Implement
Volume Write Requests to use Cache and DoubleBuffer.
URL: https://github.com/apache/hadoop/pull/884#discussion_r292231530
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
##########
@@ -451,6 +456,21 @@ private boolean startsWith(byte[] firstArray, byte[]
secondArray) {
public boolean isVolumeEmpty(String volume) throws IOException {
String volumePrefix = getVolumeKey(volume + OM_KEY_PREFIX);
+ if (bucketTable instanceof TypedTable) {
+ // First check in bucket table cache.
+ Iterator<Map.Entry<CacheKey<String>, CacheValue<OmBucketInfo>>> iterator
=
+ ((TypedTable< String, OmBucketInfo>) bucketTable).cacheIterator();
+ while (iterator.hasNext()) {
+ Map.Entry< CacheKey< String >, CacheValue< OmBucketInfo > > entry =
+ iterator.next();
+ String key = entry.getKey().getKey();
+ OmBucketInfo omBucketInfo = entry.getValue().getValue();
+ if (key.startsWith(volumePrefix) && omBucketInfo != null) {
+ return false;
+ }
+ }
+ }
+
try (TableIterator<String, ? extends KeyValue<String, OmBucketInfo>>
bucketIter = bucketTable.iterator()) {
KeyValue<String, OmBucketInfo> kv = bucketIter.seek(volumePrefix);
Review comment:
For each bucket in this iteration, we should also check in the cache that
there is no delete bucket entry..
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]