github-actions[bot] commented on code in PR #65514:
URL: https://github.com/apache/doris/pull/65514#discussion_r3568033409
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/HdfsResource.java:
##########
@@ -67,8 +67,13 @@ public HdfsResource(String name) {
@Override
public void modifyProperties(Map<String, String> properties) throws
DdlException {
- for (Map.Entry<String, String> kv : properties.entrySet()) {
- replaceIfEffectiveValue(this.properties, kv.getKey(),
kv.getValue());
+ writeLock();
+ try {
+ for (Map.Entry<String, String> kv : properties.entrySet()) {
+ replaceIfEffectiveValue(this.properties, kv.getKey(),
kv.getValue());
+ }
+ } finally {
+ writeUnlock();
Review Comment:
This still leaves a race with the journal serialization path.
`modifyProperties()` drops the resource write lock here, then
`ResourceMgr.alterResource()` logs the same live `Resource` object. With the
default batch edit-log path, `EditLogItem` stores that `Writable` reference and
the `EditLog-Flusher` serializes it later via `Resource.write()`/Gson, which
iterates `HdfsResource.properties` without taking this new read lock. A second
concurrent `ALTER RESOURCE` on the same HDFS resource can therefore mutate the
`HashMap` while the first alter is being serialized, so the original
`ConcurrentModificationException` can still happen on the edit-log path, or the
first journal entry can capture the second alter's state before that command
has completed. Please keep the resource lock held through the journal snapshot,
or snapshot the HDFS properties/resource under the lock before logging, and add
a concurrent alter/edit-log serialization test for this path.
--
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]