ChenSammi commented on code in PR #11241:
URL: https://github.com/apache/ozone/pull/11241#discussion_r4069711328
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1779,25 +1779,39 @@ public Table<String, OmLifecycleScanState>
getLifecycleScanStateTable() {
* @return list all LifecycleConfigurations.
*/
@Override
- public List<OmLifecycleConfiguration> listLifecycleConfigurations() {
+ public List<OmLifecycleConfiguration> listLifecycleConfigurations() throws
IOException {
List<OmLifecycleConfiguration> result = Lists.newArrayList();
+ Set<String> cachedKeys = new HashSet<>();
- /* lifecycleConfigurationTable is full-cache, so we use cacheIterator. */
+ // lifecycleConfigurationTable uses partial cache, so cacheIterator() only
returns
+ // entries that are currently in memory. Process cache entries first to
handle
+ // any pending writes or pending deletes that have not yet been flushed to
RocksDB.
Iterator<Map.Entry<CacheKey<String>, CacheValue<OmLifecycleConfiguration>>>
Review Comment:
> there's a window between the cacheIterator() pass and the double-buffer
flush landing in RocksDB where an entry is in neither snapshot and it's been
evicted from the cache but not yet visible to the RocksDB iterator (or vice
versa).
This will not happen. The update sequence is data -> memory cache && double
buffer, double buffer flush -> RocksDB, data remove from cache.
The major effect of having
omMetadataManager.getLock().acquireReadLock(BUCKET_LOCK, ...)) in
listLifecycleConfigurations() is to prevent new elements added into cache
during listLifecycleConfigurations is executed, which is not important for the
KeyLifecycleService, so I would keep the current behavior, without introducing
the lock contention here between the daemon service and user RPC call.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]