dschneider-pivotal commented on code in PR #7667:
URL: https://github.com/apache/geode/pull/7667#discussion_r868325789
##########
geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java:
##########
@@ -1716,67 +1723,78 @@ void doAsyncFlush() {
logger.debug("Async writer thread started");
}
boolean doingFlush = false;
+ final ThreadsMonitoring threadMonitoring = getThreadMonitoring();
+ final AbstractExecutor threadMonitorExecutor =
+ threadMonitoring.createAbstractExecutor(AsyncWriterExecutor);
+ threadMonitorExecutor.suspendMonitoring();
+ threadMonitoring.register(threadMonitorExecutor);
+
try {
while (waitUntilFlushIsReady()) {
- int drainCount = diskStore.fillDrainList();
- if (drainCount > 0) {
- Iterator<Object> it = diskStore.getDrainList().iterator();
- while (it.hasNext()) {
- Object o = it.next();
- if (o instanceof FlushNotifier) {
- flushChild();
- if (LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER) {
- if (!it.hasNext()) {
- doingFlush = false;
- CacheObserverHolder.getInstance().afterWritingBytes();
+ threadMonitorExecutor.resumeMonitoring();
+ try {
+ int drainCount = diskStore.fillDrainList();
+ if (drainCount > 0) {
+ Iterator<Object> it = diskStore.getDrainList().iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
Review Comment:
This thread could be in this inner while loop for a long time. It has to
write to disk (synchronously) every item it drained from the queue and, in the
default config, the queue has no upper bound. Just last week a saw this drain
list having 2.5m items in it.
SO every time around this inner loop you need to keep telling the monitor
that this thread is not stuck. With the current implementation of
SuspendableExecutor you could just call resumeMonitor every time around this
inner loop. But I think for clarity it would be better to add a new method to
AbstractExecutor. You could call it "reportProgress". On AbstractExecutor it
would call setStartTime(System.currentTimeMills()). But on SuspendableExecutor
it would just call setStartTime(0).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]