-
Notifications
You must be signed in to change notification settings - Fork 46
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
QPID-8666: [Broker-J] Broker plugin jdbc-provider-bone replacement #239
Conversation
final ConfiguredObjectRecord systemConfigRecord = mock(ConfiguredObjectRecord.class);; | ||
when(systemConfigRecord.getId()).thenReturn(randomUUID()); | ||
when(systemConfigRecord.getType()).thenReturn("SystemConfig"); | ||
when(systemConfigRecord.getAttributes()).thenReturn(Map.copyOf(attributes)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is taking care to copy the attributes map used for each record, but the copies still all then contain the same context original map which isnt copied. Should it be, to check each record is handled as expected, and given the test later asserts on each record's context as if they are different maps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test was fixed to use a copy of a context map for each object.
final ConfiguredObjectRecord virtualHostLoggerRecord = mock(ConfiguredObjectRecord.class);; | ||
when(virtualHostLoggerRecord.getId()).thenReturn(randomUUID()); | ||
when(virtualHostLoggerRecord.getType()).thenReturn("VirtualHostLogger"); | ||
when(virtualHostLoggerRecord.getAttributes()).thenReturn(attributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test isnt taking steps to copy the attributes map (or again the context map), as was just introduced in the other test, seems strange for them to differ in that sense when doing essentially the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test was fixed in the same way as in BrokerStoreUpgraderAndRecovererTest to keep to uniformity.
QPID-8666: [Broker-J] Broker plugin jdbc-provider-bone replacement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from prior feedback looks good.
I noticed something I didnt earlier when considering it in the context of the new changes.
I was then also looking at the earlier changes again and wonder about the apparent different naming and values between the java code and the web ui code. Its not clear to me they are consistent. Are they meant to differ in the ways they do? E.g:
Lines 51 to 52 in dae78d9
public static final int DEFAULT_MIN_IDLE = 20; | |
public static final int DEFAULT_MAX_POOLSIZE = 40; |
Lines 41 to 44 in dae78d9
static final String JDBC_STORE_PREFIX = "qpid.jdbcstore."; | |
static final String HIKARICP_SETTING_PREFIX = JDBC_STORE_PREFIX + "hikaricp."; | |
static final String MAX_POOLSIZE = HIKARICP_SETTING_PREFIX + "maximumPoolSize"; | |
static final String MIN_IDLE = HIKARICP_SETTING_PREFIX + "minimumIdle"; |
Lines 40 to 41 in dae78d9
"qpid.jdbcstore.hikaricp.minIdle": "5", | |
"qpid.jdbcstore.hikaricp.maxPoolsize": "10" |
Line 24 in dae78d9
var fieldNames = ["maxPoolsize", "minIdle"]; |
Line 71 in dae78d9
var value = context ? context["qpid.jdbcstore.hikaricp." + fieldName] : ""; |
newContext.put(MAX_POOL_SIZE_PARAM, String.valueOf(maximumPoolSize)); | ||
newContext.put(MIN_IDLE_PARAM, String.valueOf(minIdle)); | ||
} | ||
final Map<String, Object> updatedAttributes = new HashMap<>(record.getAttributes()); | ||
if (BONECP.equals(attributes.get(CP_TYPE))) | ||
else if ("Broker".equals(record.getType())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is about the if above it (new lines 103-107), rather than this else if itself, i.e about:
if (BONECP.equals(attributes.get(CP_TYPE)))
{
newContext.put(MAX_POOL_SIZE_PARAM, String.valueOf(maximumPoolSize));
newContext.put(MIN_IDLE_PARAM, String.valueOf(minIdle));
}
Doesnt that mean it always adds the new context variables, if the old type was BONECP? Even if the old config values werent actually there?
Isnt it possible for the context values to be inherited or defaulted? If so, shouldnt they only be added to a given context if actually replacing prior old values that are present in it?
(e.g like the following code for "Broker", only inserts the calculated value if the key was present...shouldnt it just always do that check rather than special-case it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name were renamed appropriately.
The upgrader code was changed to make logic for BONECP old type and "Broker" entity the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, merged
This PR is a follow-up to the PR-235 and PR-238 and addresses JIRA QPID-8666, adding upgrading the broker model version from 9.0 to 9.1