HHH-5933 : NoopOptimizer ignores negative allocationSize; uses default of 1 instead
This commit is contained in:
parent
33a28188c6
commit
dfbeb1ce37
|
@ -55,6 +55,9 @@ public final class NoopOptimizer extends AbstractOptimizer {
|
|||
|
||||
@Override
|
||||
public boolean applyIncrementSizeToSourceValues() {
|
||||
return false;
|
||||
// We allow the increment size to be 0 for backward-compatibility with legacy
|
||||
// ID generators; we don't apply a value of 0, so the default will be used instead.
|
||||
// We don't apply an increment size of 1, since it is already the default.
|
||||
return getIncrementSize() != 0 && getIncrementSize() != 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,15 +362,35 @@ public class SequenceStyleGenerator
|
|||
* @return The adjusted increment size.
|
||||
*/
|
||||
protected int determineAdjustedIncrementSize(String optimizationStrategy, int incrementSize) {
|
||||
if ( incrementSize > 1 && StandardOptimizerDescriptor.NONE.getExternalName().equals( optimizationStrategy ) ) {
|
||||
LOG.honoringOptimizerSetting(
|
||||
StandardOptimizerDescriptor.NONE.getExternalName(),
|
||||
INCREMENT_PARAM,
|
||||
incrementSize
|
||||
);
|
||||
incrementSize = 1;
|
||||
final int resolvedIncrementSize;
|
||||
if ( Math.abs( incrementSize ) > 1 &&
|
||||
StandardOptimizerDescriptor.NONE.getExternalName().equals( optimizationStrategy ) ) {
|
||||
if ( incrementSize < -1 ) {
|
||||
resolvedIncrementSize = -1;
|
||||
LOG.honoringOptimizerSetting(
|
||||
StandardOptimizerDescriptor.NONE.getExternalName(),
|
||||
INCREMENT_PARAM,
|
||||
incrementSize,
|
||||
"negative",
|
||||
resolvedIncrementSize
|
||||
);
|
||||
}
|
||||
else {
|
||||
// incrementSize > 1
|
||||
resolvedIncrementSize = 1;
|
||||
LOG.honoringOptimizerSetting(
|
||||
StandardOptimizerDescriptor.NONE.getExternalName(),
|
||||
INCREMENT_PARAM,
|
||||
incrementSize,
|
||||
"positive",
|
||||
resolvedIncrementSize
|
||||
);
|
||||
}
|
||||
}
|
||||
return incrementSize;
|
||||
else {
|
||||
resolvedIncrementSize = incrementSize;
|
||||
}
|
||||
return resolvedIncrementSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -359,11 +359,14 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void hibernateConnectionPoolSize(int poolSize, int minSize);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Config specified explicit optimizer of [%s], but [%s=%s; honoring optimizer setting", id = 116)
|
||||
@Message(value = "Config specified explicit optimizer of [%s], but [%s=%s]; using optimizer [%s] increment default of [%s].", id = 116)
|
||||
void honoringOptimizerSetting(
|
||||
String none,
|
||||
String incrementParam,
|
||||
int incrementSize);
|
||||
int incrementSize,
|
||||
String positiveOrNegative,
|
||||
int defaultIncrementSize
|
||||
);
|
||||
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "HQL: %s, time: %sms, rows: %s", id = 117)
|
||||
|
|
Loading…
Reference in New Issue