[NO ISSUE][STO] Add a way to wait only for flushes

- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- Add a method that can be used by extentions to wait only for
  pending fllushes on a dataset rather than all IO ops.

Ext-ref: MB-62692
Change-Id: I02daf3cd9680070d02fd133572950e37e68fe319
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18777
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetInfo.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetInfo.java
index 87a3c2f..bb28ef1 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetInfo.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetInfo.java
@@ -280,6 +280,20 @@
         }
     }
 
+    public void waitForFlushes() throws HyracksDataException {
+        logManager.log(waitLog);
+        synchronized (this) {
+            while (pendingFlushes > 0) {
+                try {
+                    wait();
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    throw HyracksDataException.create(e);
+                }
+            }
+        }
+    }
+
     public synchronized int getPendingFlushes() {
         return pendingFlushes;
     }