-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29274: Flaky TestMetastoreLeaseLeader#testHouseKeepingThreads #6142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
...unit/src/test/java/org/apache/hadoop/hive/metastore/MetastoreHousekeepingLeaderTestBase.java
Outdated
Show resolved
Hide resolved
...unit/src/test/java/org/apache/hadoop/hive/metastore/MetastoreHousekeepingLeaderTestBase.java
Outdated
Show resolved
Hide resolved
...unit/src/test/java/org/apache/hadoop/hive/metastore/MetastoreHousekeepingLeaderTestBase.java
Outdated
Show resolved
Hide resolved
...ive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreHousekeepingLeader.java
Outdated
Show resolved
Hide resolved
...tore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/LeaderElectionContext.java
Outdated
Show resolved
Hide resolved
...astore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/LeaseLeaderElection.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments
...astore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/LeaseLeaderElection.java
Outdated
Show resolved
Hide resolved
...astore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/LeaseLeaderElection.java
Outdated
Show resolved
Hide resolved
...astore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java
Outdated
Show resolved
Hide resolved
...astore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java
Outdated
Show resolved
Hide resolved
4f6e514 to
9f03d15
Compare
|
| public enum TTYPE { | ||
| HOUSEKEEPING(new TableName(Warehouse.DEFAULT_CATALOG_NAME, "__METASTORE_LEADER_ELECTION__", | ||
| "metastore_housekeeping"), "housekeeping"), | ||
| WORKER(new TableName(Warehouse.DEFAULT_CATALOG_NAME, "__METASTORE_LEADER_ELECTION__", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! we forgot to drop this
| listenerMap.entrySet()) { | ||
| List<LeadershipStateListener> listenerList = entry.getValue(); | ||
| List<TTYPE> ttypes = new ArrayList<>(listeners.keySet()); | ||
| Collections.shuffle(ttypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to shuffle?
| MetastoreConf.setVar(conf, ConfVars.METASTORE_HOUSEKEEPING_LEADER_HOSTNAME, leaderHostName); | ||
| MetastoreConf.setVar(conf, ConfVars.METASTORE_HOUSEKEEPING_LEADER_ELECTION, | ||
| configuredLeader ? "host" : "lock"); | ||
| leaderHostName != null ? "host" : "lock"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please try use enum (i.e Method from LeaderElectionFactory)
| wait(service, flag1, flag2); | ||
| // now instance1 lease is timeout, the instance2 should be leader now | ||
| instance1.close(); | ||
| synchronized (flag2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need synchronized here? AtomicBoolean is designed for lock-free atomic updates.
while (!flag2.get()) {
Thread.onSpinWait(); // JDK 9+
}
| private static final Logger LOG = LoggerFactory.getLogger(LeaseLeaderElection.class); | ||
|
|
||
| private static final AtomicLong ID = new AtomicLong(); | ||
| protected static final AtomicLong ID = new AtomicLong(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't it be better if we expose protected fields via getters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1, some minor suggestions



What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
No
How was this patch tested?
https://ci.hive.apache.org/job/hive-flaky-check/915