Honda Yasuhisa created HBASE-30554:
--------------------------------------
Summary: Concurrent HbckChore invocations can trigger redundant
sequential scans
Key: HBASE-30554
URL: https://issues.apache.org/jira/browse/HBASE-30554
Project: HBase
Issue Type: Bug
Reporter: Honda Yasuhisa
Currently, {{HbckChore.runChore()}} checks whether the chore is running before
calling the {{chore()}} method. However, the check and the assignment of
{{running = true}} are not atomic.
{code:java}
public boolean runChore() {
// This function does the sanity checks of making sure the chore is not run
when it is
// disabled or when it's already running. It returns whether the chore was
actually run or not.
if (isDisabled() || isRunning()) {
if (isDisabled()) {
LOG.warn("hbck chore is disabled! Set " + HBCK_CHORE_INTERVAL + " > 0
to enable it.");
} else {
LOG.warn("hbck chore already running. Can't run till it finishes.");
}
return false;
}
chore();
return true;
} {code}
ref:
[https://github.com/apache/hbase/blob/23ffbcca7c589758d1ea83a1035a7d451a215ce3/hbase-server/src/main/java/org/apache/hadoop/hbase/master/hbck/HbckChore.java#L122]
{code:java}
@Override
protected synchronized void chore() {
if (isDisabled() || isRunning()) {
LOG.warn("hbckChore is either disabled or is already running. Can't run
the chore");
return;
}
running = true;
:{code}
ref:
[https://github.com/apache/hbase/blob/23ffbcca7c589758d1ea83a1035a7d451a215ce3/hbase-server/src/main/java/org/apache/hadoop/hbase/master/hbck/HbckChore.java#L92]
Multiple threads can pass the check before any of them set running to
{{{}true{}}}. While synchronization prevents concurrent execution of HbckChore,
it doesn't prevent redundant sequential scans. A competing callers block until
the current scan finishes.
Concurrent requests should be rejected (return false) instead of blocking until
current scan finishes and then starting another scan.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)