ivanzlenko commented on code in PR #7526:
URL: https://github.com/apache/ignite-3/pull/7526#discussion_r2759478610
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataRegion.java:
##########
@@ -207,41 +206,41 @@ private static PersistentDataRegionConfiguration
regionConfiguration(
.pageSize(pageSize)
.size(sizeBytes)
.replacementMode(ReplacementMode.valueOf(cfg.replacementMode()))
+ .throttlingPolicyFactory(throttlingPolicyFactory())
.build();
}
- // TODO IGNITE-24933 refactor.
- private void initThrottling(PersistentPageMemory pageMemory) {
+ private ThrottlingPolicyFactory throttlingPolicyFactory() {
ThrottlingType throttlingType = getThrottlingType();
switch (throttlingType) {
case DISABLED:
- break;
+ return pageMemory -> null;
case TARGET_RATIO:
- pageMemory.initThrottling(new TargetRatioPagesWriteThrottle(
+ return pageMemory -> new TargetRatioPagesWriteThrottle(
getLoggingThreshold(),
pageMemory,
checkpointManager::currentCheckpointProgressForThrottling,
checkpointManager.checkpointTimeoutLock()::checkpointLockIsHeldByThread,
metricSource
- ));
- break;
+ );
case SPEED_BASED:
- pageMemory.initThrottling(new PagesWriteSpeedBasedThrottle(
+ return pageMemory -> new PagesWriteSpeedBasedThrottle(
getLoggingThreshold(),
getMinDirtyPages(),
getMaxDirtyPages(),
pageMemory,
checkpointManager::currentCheckpointProgressForThrottling,
checkpointManager.checkpointTimeoutLock()::checkpointLockIsHeldByThread,
metricSource
- ));
- break;
+ );
default:
assert false : "Impossible throttling type: " + throttlingType;
Review Comment:
Can we remove this line? It feels like a remnant of debug code.
##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/throttling/PageMemoryThrottlingTest.java:
##########
@@ -133,8 +133,7 @@ static void afterAll() {
ioRegistry = null;
}
- @BeforeEach
- void setUp() throws Exception {
+ void setUp(ThrottlingPolicyFactory throttleFactory) throws Exception {
Review Comment:
Could be private
--
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]