This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch opt_dict_perf in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/opt_dict_perf by this push: new 7085a3d5ed f 7085a3d5ed is described below commit 7085a3d5eda9b5a6636336c5042537ec29e34590 Author: yiguolei <yiguo...@gmail.com> AuthorDate: Wed Mar 15 16:20:54 2023 +0800 f --- .../src/main/java/org/apache/doris/catalog/TabletStatMgr.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java index eb6e7dd83d..acead86893 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java @@ -35,6 +35,7 @@ import org.apache.logging.log4j.Logger; import java.util.List; import java.util.Map; import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.TimeUnit; /* * TabletStatMgr is for collecting tablet(replica) statistics from backends. @@ -95,7 +96,13 @@ public class TabletStatMgr extends MasterDaemon { continue; } OlapTable olapTable = (OlapTable) table; - if (!table.writeLockIfExist()) { + // Use try write lock to avoid such cases + // Time1: Thread1 hold read lock for 5min + // Time2: Thread2 want to add write lock, then it will be the first element in lock queue + // Time3: Thread3 want to add read lock, but it will not, because thread 2 want to add write lock + // In this case, thread 3 has to wait more than 5min, because it has to wait thread 2 to add + // write lock and release write lock and thread 2 has to wait thread 1 to release read lock + if (!table.tryWriteLockIfExist(3000, TimeUnit.MILLISECONDS)) { continue; } try { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org