morrySnow commented on code in PR #65476:
URL: https://github.com/apache/doris/pull/65476#discussion_r3569557795


##########
fe/fe-core/src/main/java/org/apache/doris/dictionary/DictionaryManager.java:
##########
@@ -282,6 +285,19 @@ private boolean hasDictionaryWithoutLock(String dbName, 
String dictName) {
         return dbDictIds != null && dbDictIds.containsKey(dictName);
     }
 
+    public boolean isCurrentDictionary(Dictionary dictionary) {
+        lockRead();

Review Comment:
   The lockRead()/unlockRead() in isCurrentDictionary() is unnecessary for 
correctness. idToDictionary is a ConcurrentMap backed by ConcurrentHashMap 
(line 100), whose get() is already atomic with happens-before guarantees. All 
mutation paths hold the write lock. The codebase itself demonstrates lock-free 
idToDictionary reads: collectDictionaryStatus() at line 697 iterates 
idToDictionary.values() without a lock, with comment "should not under lock 
because of RPC." Either the lock should be removed or a comment should explain 
what it serializes against beyond ConcurrentHashMap guarantees.



-- 
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]

Reply via email to