Repository: asterixdb Updated Branches: refs/heads/master 4c5fb5c31 -> 6868d7da9
[NO ISSUE] Warn when memory settings are invalid Right now you can set memory settings that make the node's available memory less than zero. This is easier to do than it sounds due to the difference between runtime max memory and maximum overall heap size. Change-Id: I7baace491b9542b6b69a8f697d29e036ec494a16 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2241 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/6868d7da Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/6868d7da Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/6868d7da Branch: refs/heads/master Commit: 6868d7da9b34d11590041b76abaa7e31fcdd8de3 Parents: 4c5fb5c Author: Ian Maxon <[email protected]> Authored: Wed Dec 20 01:10:19 2017 -0800 Committer: Ian Maxon <[email protected]> Committed: Thu Dec 21 11:37:52 2017 -0800 ---------------------------------------------------------------------- .../apache/asterix/hyracks/bootstrap/NCApplication.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6868d7da/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java index e1a75cb..e22372a 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java @@ -118,8 +118,8 @@ public class NCApplication extends BaseNCApplication { MessagingProperties messagingProperties = runtimeContext.getMessagingProperties(); IMessageBroker messageBroker = new NCMessageBroker(controllerService, messagingProperties); this.ncServiceCtx.setMessageBroker(messageBroker); - MessagingChannelInterfaceFactory interfaceFactory = new MessagingChannelInterfaceFactory( - (NCMessageBroker) messageBroker, messagingProperties); + MessagingChannelInterfaceFactory interfaceFactory = + new MessagingChannelInterfaceFactory((NCMessageBroker) messageBroker, messagingProperties); this.ncServiceCtx.setMessagingChannelInterfaceFactory(interfaceFactory); final Checkpoint latestCheckpoint = runtimeContext.getTransactionSubsystem().getCheckpointManager().getLatest(); if (latestCheckpoint != null) { @@ -221,6 +221,12 @@ public class NCApplication extends BaseNCApplication { // and deducts one core for processing heartbeats. long memorySize = Runtime.getRuntime().maxMemory() - storageProperties.getBufferCacheSize() - storageProperties.getMemoryComponentGlobalBudget(); + if (memorySize <= 0) { + throw new IllegalStateException("Invalid node memory configuration, more memory budgeted than available " + + "in JVM. Runtime max memory: " + Runtime.getRuntime().maxMemory() + " Buffer cache size: " + + storageProperties.getBufferCacheSize() + " Memory component global budget: " + + storageProperties.getMemoryComponentGlobalBudget()); + } int allCores = Runtime.getRuntime().availableProcessors(); int maximumCoresForComputation = allCores > 1 ? allCores - 1 : allCores; return new NodeCapacity(memorySize, maximumCoresForComputation);
