[NO ISSUE][OTH] Increase number of archived requests

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

Details:
Increase the number of tracked archived requests to 1000.
Set max statement length (and plan) to 64KB.

Change-Id: I884656d3a6a323fdb787887bedb3bcc501eb94f1
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18302
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ClientRequest.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ClientRequest.java
index 31f1979..bd62814 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ClientRequest.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ClientRequest.java
@@ -34,11 +34,14 @@
 import org.apache.hyracks.api.job.resource.IReadOnlyClusterCapacity;
 import org.apache.hyracks.api.util.ExceptionUtils;
 import org.apache.hyracks.util.LogRedactionUtil;
+import org.apache.hyracks.util.StorageUtil;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ClientRequest extends BaseClientRequest {
 
+    protected static final int MAX_STATEMENT_LENGTH =
+            StorageUtil.getIntSizeInBytes(64, StorageUtil.StorageUnit.KILOBYTE);
     protected final long creationTime = System.nanoTime();
     protected final Thread executor;
     protected final String statement;
@@ -50,7 +53,8 @@
     public ClientRequest(ICommonRequestParameters requestParameters) {
         super(requestParameters.getRequestReference());
         this.clientContextId = requestParameters.getClientContextId();
-        this.statement = requestParameters.getStatement();
+        String stmt = requestParameters.getStatement();
+        this.statement = stmt.length() > MAX_STATEMENT_LENGTH ? stmt.substring(0, MAX_STATEMENT_LENGTH) : stmt;
         this.executor = Thread.currentThread();
         this.jobState = new JobState();
     }
@@ -61,7 +65,9 @@
     }
 
     public void setPlan(String plan) {
-        this.plan = plan;
+        if (plan != null) {
+            this.plan = plan.length() > MAX_STATEMENT_LENGTH ? plan.substring(0, MAX_STATEMENT_LENGTH) : plan;
+        }
     }
 
     public synchronized void setJobId(JobId jobId) {
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/completed_requests/completed_requests.3.plans.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/completed_requests/completed_requests.3.plans.sqlpp
index 0e75d22..cf0c86c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/completed_requests/completed_requests.3.plans.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/completed_requests/completed_requests.3.plans.sqlpp
@@ -25,6 +25,8 @@
 -- param job:string=true
 
 SET `compiler.parallelism` "1";
+// this of course defeats the purpose of the test. however, the currently min assigned memory is too low for a request
+SET `compiler.min.memory.allocation` "false";
 
 from completed_requests() t
 select value t
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
index 515aad6..8aa4532 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
@@ -50,7 +50,7 @@
                 POSITIVE_INTEGER_BYTE_UNIT,
                 StorageUtil.getIntSizeInBytes(200, StorageUtil.StorageUnit.MEGABYTE),
                 "The maximum accepted web request size in bytes"),
-        REQUESTS_ARCHIVE_SIZE(NONNEGATIVE_INTEGER, 50, "The maximum number of archived requests to maintain"),
+        REQUESTS_ARCHIVE_SIZE(NONNEGATIVE_INTEGER, 1000, "The maximum number of archived requests to maintain"),
         LIBRARY_DEPLOY_TIMEOUT(POSITIVE_INTEGER, 1800, "Timeout to upload a UDF in seconds"),
         AZURE_REQUEST_TIMEOUT(POSITIVE_INTEGER, 120, "Timeout for Azure client requests in seconds");
 
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractFrameSorter.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractFrameSorter.java
index b121fbb..20924d5 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractFrameSorter.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/sort/AbstractFrameSorter.java
@@ -150,8 +150,9 @@
             return true;
         }
         if (getFrameCount() == 0) {
-            throw new HyracksDataException(
-                    "The input frame is too big for the sorting buffer, please allocate bigger buffer size");
+            throw new HyracksDataException("The required memory=" + requiredMemory + " for the frame data="
+                    + inputTupleAccessor.getBuffer().capacity() + " is too big for the sorting buffer. Used="
+                    + totalMemoryUsed + ", max=" + maxSortMemory + ", please allocate bigger buffer size");
         }
         return false;
     }