Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing backward compatibility issue for PER_NODE capacity calculation algorithm #12195

Merged
merged 4 commits into from Apr 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -53,6 +53,7 @@
public class EvictionChecker {

protected static final double ONE_HUNDRED_PERCENT = 100D;
private static final int MIN_SANE_PER_PARTITION_SIZE = 2;

protected final ILogger logger;
protected final MapServiceContext mapServiceContext;
Expand Down Expand Up @@ -123,14 +124,17 @@ public double translatePerNodeSizeToRecordStoreSize(RecordStore recordStore) {
int memberCount = nodeEngine.getClusterService().getSize(DATA_MEMBER_SELECTOR);
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();

final double perNodeMaxRecordStoreSize = (1D * configuredMaxSize * memberCount / partitionCount);
if (perNodeMaxRecordStoreSize < 1
&& misconfiguredPerNodeMaxSizeWarningLogged.compareAndSet(false, true)) {
int minMaxSize = (int) Math.ceil((1D * partitionCount / memberCount));
String msg = "The max size configuration for map '%s' does not allow "
+ " any data in the map. Given the current cluster size of %d "
+ "members with %d partitions, max size should be at least %d.";
logger.warning(format(msg, mapConfig.getName(), memberCount, partitionCount, minMaxSize));
double perNodeMaxRecordStoreSize = (1D * configuredMaxSize * memberCount / partitionCount);
if (perNodeMaxRecordStoreSize < 1) {
perNodeMaxRecordStoreSize = MIN_SANE_PER_PARTITION_SIZE;
if (misconfiguredPerNodeMaxSizeWarningLogged.compareAndSet(false, true)) {
int minMaxSize = (int) Math.ceil((1D * partitionCount / memberCount));
int newSize = MIN_SANE_PER_PARTITION_SIZE * partitionCount / memberCount;
logger.warning(format("The max size configuration for map \"%s\" does not allow any data in the map. "
+ "Given the current cluster size of %d members with %d partitions, max size should be at "
+ "least %d. Map size is forced set to %d for backward compatibility", mapConfig.getName(),
memberCount, partitionCount, minMaxSize, newSize));
}
}
return perNodeMaxRecordStoreSize;
}
Expand Down