Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,6 @@ public boolean isBucketEmpty(String volume, String bucket)
return true;
}


/**
* Checks if a key starting with a given keyPrefix exists in the table cache.
*
Expand All @@ -978,20 +977,22 @@ public boolean isBucketEmpty(String volume, String bucket)
*/
private boolean isKeyPresentInTableCache(String keyPrefix,
Table table) {
Comment thread
adoroszlai marked this conversation as resolved.
Outdated
Iterator<Map.Entry<CacheKey<String>, CacheValue<OmKeyInfo>>> iterator =
Iterator<Map.Entry<CacheKey<String>, CacheValue<Object>>> iterator =
table.cacheIterator();
while (iterator.hasNext()) {
Map.Entry<CacheKey<String>, CacheValue<OmKeyInfo>> entry =
Map.Entry<CacheKey<String>, CacheValue<Object>> entry =
iterator.next();
String key = entry.getKey().getCacheKey();
OmKeyInfo omKeyInfo = entry.getValue().getCacheValue();
Object value = entry.getValue().getCacheValue();

// Making sure that entry is not for delete key request.
if (key.startsWith(keyPrefix) && omKeyInfo != null) {
if (key.startsWith(keyPrefix) && value != null) {
return true;
}
}
return false;
}

/**
* Checks if a key starts with the given prefix is present in the table.
*
Expand All @@ -1001,18 +1002,18 @@ private boolean isKeyPresentInTableCache(String keyPrefix,
* @throws IOException
*/
private boolean isKeyPresentInTable(String keyPrefix,
Table<String, OmKeyInfo> table)
Table table)
Comment thread
adoroszlai marked this conversation as resolved.
Outdated
throws IOException {
try (TableIterator<String, ? extends KeyValue<String, OmKeyInfo>>
try (TableIterator<String, ? extends KeyValue<String, Object>>
keyIter = table.iterator()) {
KeyValue<String, OmKeyInfo> kv = keyIter.seek(keyPrefix);
KeyValue<String, Object> kv = keyIter.seek(keyPrefix);

// Iterate through all the entries in the table which start with
// the current bucket's prefix.
while (kv != null && kv.getKey().startsWith(keyPrefix)) {
// Check the entry in db is not marked for delete. This can happen
// while entry is marked for delete, but it is not flushed to DB.
CacheValue<OmKeyInfo> cacheValue =
CacheValue<Object> cacheValue =
table.getCacheValue(new CacheKey(kv.getKey()));

// Case 1: We found an entry, but no cache entry.
Expand Down