Alex Behm has posted comments on this change. Change subject: IMPALA-4449: Revisit table locking pattern in the catalog ......................................................................
Patch Set 2: (4 comments) http://gerrit.cloudera.org:8080/#/c/5710/2/fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java File fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java: Line 184: private static final long TIMEOUT_FOR_TBL_LOCK_IN_MSEC = 3600000; We usually use the MS suffix elsewhere, i.e., TBL_LOCK_TIMEOUT_MS I think we should consider making this higher and/or even configurable (in a separate patch). Line 187: * Tries to acquire a table lock while holding the catalogLock_. Returns true if it Tries to acquire the catalogLock_ and the lock of 'tbl' in that order. Line 205: Thread.yield(); I believe this will call sched_yield() on Linux, so may still end up with busy-spinning-like behavior or at least unpredictable "waiting" times. What's wrong with Thread.sleep()? http://gerrit.cloudera.org:8080/#/c/5710/2/fe/src/main/java/org/apache/impala/catalog/Table.java File fe/src/main/java/org/apache/impala/catalog/Table.java: Line 72: private final ReentrantLock tableLock_ = new ReentrantLock(true); Thinking about this a little more: Why does this lock need to be fair? We don't really wait for it and instead we have a try+retry loop. I'm mostly asking because forcing fairness could mislead readers if that feature is not really needed/used. I think preventing starvation with a try+retry approach will be hard. -- To view, visit http://gerrit.cloudera.org:8080/5710 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id08e21da31deb1f003b3cada4517651f3b3b2bb2 Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Dimitris Tsirogiannis <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Bharath Vissapragada <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Dimitris Tsirogiannis <[email protected]> Gerrit-Reviewer: Marcel Kornacker <[email protected]> Gerrit-HasComments: Yes
