HBASE-24840 Avoid shows closing region task when create table (#2226)

This commit is contained in:
bsglz 2020-10-11 19:12:56 +08:00 committed by GitHub
parent accd9750aa
commit 5a474449c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -87,8 +87,12 @@ public class TaskMonitor {
}
return instance;
}
public synchronized MonitoredTask createStatus(String description) {
return createStatus(description, false);
}
public synchronized MonitoredTask createStatus(String description, boolean ignore) {
MonitoredTask stat = new MonitoredTaskImpl();
stat.setDescription(description);
MonitoredTask proxy = (MonitoredTask) Proxy.newProxyInstance(
@ -99,7 +103,9 @@ public class TaskMonitor {
if (tasks.isFull()) {
purgeExpiredTasks();
}
tasks.add(pair);
if (!ignore) {
tasks.add(pair);
}
return proxy;
}

View File

@ -1578,6 +1578,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
*/
public static final long MAX_FLUSH_PER_CHANGES = 1000000000; // 1G
public Map<byte[], List<HStoreFile>> close(boolean abort) throws IOException {
return close(abort, false);
}
/**
* Close down this HRegion. Flush the cache unless abort parameter is true,
* Shut down each HStore, don't service any more calls.
@ -1586,6 +1590,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* time-sensitive thread.
*
* @param abort true if server is aborting (only during testing)
* @param ignoreStatus true if ignore the status (wont be showed on task list)
* @return Vector of all the storage files that the HRegion's component
* HStores make use of. It's a list of StoreFile objects. Can be null if
* we are not to close at this time or we are already closed.
@ -1595,12 +1600,13 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* because a Snapshot was not properly persisted. The region is put in closing mode, and the
* caller MUST abort after this.
*/
public Map<byte[], List<HStoreFile>> close(boolean abort) throws IOException {
public Map<byte[], List<HStoreFile>> close(boolean abort, boolean ignoreStatus)
throws IOException {
// Only allow one thread to close at a time. Serialize them so dual
// threads attempting to close will run up against each other.
MonitoredTask status = TaskMonitor.get().createStatus(
"Closing region " + this.getRegionInfo().getEncodedName() +
(abort ? " due to abort" : ""));
(abort ? " due to abort" : ""), ignoreStatus);
status.enableStatusJournal(true);
status.setStatus("Waiting for close lock");
try {

View File

@ -186,7 +186,7 @@ public abstract class ModifyRegionUtils {
}
} finally {
// 3. Close the new region to flush to disk. Close log file too.
region.close();
region.close(false, true);
}
return region.getRegionInfo();
}