cryptoe commented on code in PR #13846:
URL: https://github.com/apache/druid/pull/13846#discussion_r1119610809
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/WorkerMemoryParameters.java:
##########
@@ -431,6 +466,26 @@ private static long memoryPerBundle(
return memoryForBundles / bundleCount;
}
+ /**
+ * Used for estimating the usable memory for better exception messages when
{@link NotEnoughMemoryFault} is thrown.
+ */
+ private static long estimateUsableMemory(
+ final int numWorkersInJvm,
+ final int numProcessingThreadsInJvm,
+ final long estimatedEachBundleMemory
+ )
+ {
+ final int bundleCount = numWorkersInJvm + numProcessingThreadsInJvm;
+ return estimateUsableMemory(numWorkersInJvm, estimatedEachBundleMemory *
bundleCount);
+
+ }
+
+ private static long estimateUsableMemory(final int numWorkersInJvm, final
long estimatedTotalBundleMemory)
+ {
+ final long estimatedWorkerMemory = numWorkersInJvm *
PARTITION_STATS_MEMORY_MAX_BYTES;
Review Comment:
Added some comments and fixed a bug as well.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]