>From Ali Alsuliman <[email protected]>:

Ali Alsuliman has submitted this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21273?usp=email )

Change subject: [ASTERIXDB-3649][FUN] Add data-source function for ASYNC 
requests
......................................................................

[ASTERIXDB-3649][FUN] Add data-source function for ASYNC requests

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

Ext-ref: MB-71998
Change-Id: I8ebde4bc76b0e0dfab71bace7c29ead8a2316ae3
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21273
Reviewed-by: Murtadha Hubail <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
---
A 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsDatasource.java
A 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsRewriter.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ClientRequestsRequest.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/util/MetadataBuiltinFunctions.java
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.1.async.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.2.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.3.plans.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.4.pollget.http
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.5.delete.http
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.6.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.1.ignore
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.2.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.3.regex
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.4.ignore
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.5.ignore
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.6.adm
M asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IRequestTracker.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RequestTracker.java
19 files changed, 265 insertions(+), 1 deletion(-)

Approvals:
  Jenkins: Verified; Verified
  Murtadha Hubail: Looks good to me, approved
  Anon. E. Moose #1000171:




diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsDatasource.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsDatasource.java
new file mode 100644
index 0000000..a2f112f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsDatasource.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.app.function;
+
+import java.util.Objects;
+
+import org.apache.asterix.app.message.ClientRequestsRequest;
+import org.apache.asterix.metadata.api.IDatasourceFunction;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.FunctionDataSource;
+import org.apache.asterix.metadata.declared.MetadataProvider;
+import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
+
+public class AsyncRequestsDatasource extends FunctionDataSource {
+
+    private static final DataSourceId ASYNC_REQUESTS_DATASOURCE_ID =
+            createDataSourceId(AsyncRequestsRewriter.ASYNC_REQUESTS);
+
+    public AsyncRequestsDatasource(INodeDomain domain) throws 
AlgebricksException {
+        super(ASYNC_REQUESTS_DATASOURCE_ID, 
AsyncRequestsRewriter.ASYNC_REQUESTS, domain);
+    }
+
+    @Override
+    protected IDatasourceFunction createFunction(MetadataProvider 
metadataProvider,
+            AlgebricksAbsolutePartitionConstraint locations) {
+        AlgebricksAbsolutePartitionConstraint randomLocation =
+                
AlgebricksAbsolutePartitionConstraint.randomLocation(locations.getLocations());
+        return new ClientRequestsFunction(randomLocation, 
ClientRequestsRequest.RequestType.ASYNC);
+    }
+
+    @Override
+    public boolean skipJobCapacityAssignment() {
+        return true;
+    }
+
+    @Override
+    protected boolean sameFunctionDatasource(FunctionDataSource other) {
+        return Objects.equals(this.functionId, other.getFunctionId());
+    }
+}
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsRewriter.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsRewriter.java
new file mode 100644
index 0000000..96ffc8b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/AsyncRequestsRewriter.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.app.function;
+
+import org.apache.asterix.common.functions.FunctionConstants;
+import org.apache.asterix.metadata.declared.FunctionDataSource;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import 
org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class AsyncRequestsRewriter extends FunctionRewriter {
+
+    public static final FunctionIdentifier ASYNC_REQUESTS = 
FunctionConstants.newAsterix("async-requests", 0);
+    public static final AsyncRequestsRewriter INSTANCE = new 
AsyncRequestsRewriter(ASYNC_REQUESTS);
+
+    private AsyncRequestsRewriter(FunctionIdentifier functionId) {
+        super(functionId);
+    }
+
+    @Override
+    protected FunctionDataSource toDatasource(IOptimizationContext context, 
AbstractFunctionCallExpression f)
+            throws AlgebricksException {
+        return new AsyncRequestsDatasource(context.getComputationNodeDomain());
+    }
+}
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ClientRequestsRequest.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ClientRequestsRequest.java
index 32667d8..be6e76a 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ClientRequestsRequest.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/ClientRequestsRequest.java
@@ -33,7 +33,8 @@

     public enum RequestType {
         RUNNING,
-        COMPLETED
+        COMPLETED,
+        ASYNC
     }

     private static final Logger LOGGER = LogManager.getLogger();
@@ -58,6 +59,9 @@
             case COMPLETED:
                 clientRequests = 
appCtx.getRequestTracker().getCompletedRequests();
                 break;
+            case ASYNC:
+                clientRequests = appCtx.getRequestTracker().getAsyncRequests();
+                break;
             default:
                 throw new IllegalStateException("unrecognized request type: " 
+ requestType);
         }
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/util/MetadataBuiltinFunctions.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/util/MetadataBuiltinFunctions.java
index e86eb8a..1cf7d61 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/util/MetadataBuiltinFunctions.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/util/MetadataBuiltinFunctions.java
@@ -19,6 +19,7 @@
 package org.apache.asterix.util;

 import org.apache.asterix.app.function.ActiveRequestsRewriter;
+import org.apache.asterix.app.function.AsyncRequestsRewriter;
 import org.apache.asterix.app.function.CompletedRequestsRewriter;
 import org.apache.asterix.app.function.DatasetResourcesRewriter;
 import org.apache.asterix.app.function.DatasetRewriter;
@@ -83,6 +84,12 @@
         BuiltinFunctions.addUnnestFun(ActiveRequestsRewriter.ACTIVE_REQUESTS, 
true);
         
BuiltinFunctions.addDatasourceFunction(ActiveRequestsRewriter.ACTIVE_REQUESTS, 
ActiveRequestsRewriter.INSTANCE,
                 BuiltinFunctions.DataSourceFunctionProperty.MIN_MEMORY_BUDGET);
+        // Async requests function
+        BuiltinFunctions.addFunction(AsyncRequestsRewriter.ASYNC_REQUESTS,
+                (expression, env, mp) -> RecordUtil.FULLY_OPEN_RECORD_TYPE, 
true);
+        BuiltinFunctions.addUnnestFun(AsyncRequestsRewriter.ASYNC_REQUESTS, 
true);
+        
BuiltinFunctions.addDatasourceFunction(AsyncRequestsRewriter.ASYNC_REQUESTS, 
AsyncRequestsRewriter.INSTANCE,
+                BuiltinFunctions.DataSourceFunctionProperty.MIN_MEMORY_BUDGET);
         // job-summaries function
         BuiltinFunctions.addPrivateFunction(JobSummariesRewriter.JOBSUMMARIES,
                 (expression, env, mp) -> RecordUtil.FULLY_OPEN_RECORD_TYPE, 
true);
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.1.async.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.1.async.sqlpp
new file mode 100644
index 0000000..27e3bbc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.1.async.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- param client_context_id=async_query
+-- handlevariable=status
+-- param include-host=false
+SELECT COUNT(*) FROM Metadata.`Dataset` v;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.2.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.2.query.sqlpp
new file mode 100644
index 0000000..1b371a3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.2.query.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT VALUE rqst.clientContextID FROM async_requests() rqst WHERE 
rqst.clientContextID = "async_query";
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.3.plans.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.3.plans.sqlpp
new file mode 100644
index 0000000..0eb6eb2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.3.plans.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Test that a query that only uses async_requests() gets assigned a minimal 
memory budget
+ */
+
+-- param job:string=true
+
+SET `compiler.parallelism` "1";
+
+from async_requests() t
+select value t
+order by t;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.4.pollget.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.4.pollget.http
new file mode 100644
index 0000000..5b33e8b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.4.pollget.http
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+-- polltimeoutsecs=20
+-- handlevariable=result
+$status
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.5.delete.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.5.delete.http
new file mode 100644
index 0000000..0404b04
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.5.delete.http
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+$result
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.6.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.6.query.sqlpp
new file mode 100644
index 0000000..1b371a3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/async_requests/async_requests.6.query.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT VALUE rqst.clientContextID FROM async_requests() rqst WHERE 
rqst.clientContextID = "async_query";
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.1.ignore
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.1.ignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.1.ignore
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.2.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.2.adm
new file mode 100644
index 0000000..cb3df79
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.2.adm
@@ -0,0 +1 @@
+"async_query"
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.3.regex
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.3.regex
new file mode 100644
index 0000000..695472c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.3.regex
@@ -0,0 +1 @@
+/memory\D+0/
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.4.ignore
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.4.ignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.4.ignore
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.5.ignore
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.5.ignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.5.ignore
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.6.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.6.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/async_requests/async_requests.6.adm
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
index 5e64cca..4b39073 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
@@ -7544,6 +7544,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="misc">
+      <compilation-unit name="async_requests">
+        <output-dir compare="Text">async_requests</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="misc">
       <compilation-unit name="limit_after_offset">
         <output-dir compare="Text">limit_after_offset</output-dir>
       </compilation-unit>
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IRequestTracker.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IRequestTracker.java
index b5592fe..27acf85 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IRequestTracker.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IRequestTracker.java
@@ -80,6 +80,13 @@
     Collection<IClientRequest> getCompletedRequests();

     /**
+     * Gets the async requests
+     *
+     * @return the async requests
+     */
+    Collection<IClientRequest> getAsyncRequests();
+
+    /**
      *
      * @return the total number of requests since cluster start/restart
      */
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RequestTracker.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RequestTracker.java
index f596e07..62716be 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RequestTracker.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RequestTracker.java
@@ -133,6 +133,11 @@
         return Collections.unmodifiableCollection(new 
ArrayList<>(completedRequests.values()));
     }

+    @Override
+    public synchronized Collection<IClientRequest> getAsyncRequests() {
+        return Collections.unmodifiableCollection(asyncRequests.values());
+    }
+
     private boolean cancel(IClientRequest request) throws HyracksDataException 
{
         boolean cancelled = request.cancel(ccAppCtx);
         if (cancelled) {

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21273?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: I8ebde4bc76b0e0dfab71bace7c29ead8a2316ae3
Gerrit-Change-Number: 21273
Gerrit-PatchSet: 6
Gerrit-Owner: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>

Reply via email to