Skip to content

Commit

Permalink
IGNITE-20697 Review comments fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-plekhanov committed Feb 6, 2025
1 parent 70dc85e commit 9cf9f91
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1567,9 +1567,11 @@ private long requiredOffheap() {
}
}

res += memCfg.getDefaultDataRegionConfiguration().getMaxSize();
DataRegionConfiguration dfltDataRegion = memCfg.getDefaultDataRegionConfiguration();

res += U.checkpointBufferSize(memCfg, memCfg.getDefaultDataRegionConfiguration());
res += dfltDataRegion.getMaxSize();

res += U.checkpointBufferSize(memCfg, dfltDataRegion);

return res;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@
*
*/
public class CheckpointRecoveryFileStorage {
/** */
private static final String FILE_NAME_TAG = "-RECOVERY-";

/** Checkpoint recovery file name pattern. */
public static final Pattern FILE_NAME_PATTERN = Pattern.compile("(\\d+)-(.*)-RECOVERY-(\\d+)\\.bin");
public static final Pattern FILE_NAME_PATTERN = Pattern.compile("(\\d+)-(.*)" + FILE_NAME_TAG + "(\\d+)\\.bin");

/** Context. */
private final GridKernalContext ctx;
Expand Down Expand Up @@ -72,7 +75,7 @@ public CheckpointRecoveryFileStorage(GridKernalContext ctx, File dir, FileIOFact

/** */
private static String fileName(long cpTs, UUID cpId, int idx) {
return cpTs + "-" + cpId + "-" + "RECOVERY-" + idx + ".bin";
return cpTs + "-" + cpId + FILE_NAME_TAG + idx + ".bin";
}

/**
Expand All @@ -97,7 +100,7 @@ public CheckpointRecoveryFile create(long cpTs, UUID cpId, int idx) throws Stora
* @return List of recovery files.
*/
public List<CheckpointRecoveryFile> list(@Nullable Predicate<UUID> predicate) throws StorageException {
File[] files = dir.listFiles(f -> f.isFile() && f.getName().contains("-RECOVERY-"));
File[] files = dir.listFiles(f -> f.isFile() && f.getName().contains(FILE_NAME_TAG));
List<CheckpointRecoveryFile> fileList = new ArrayList<>();

for (File file : files) {
Expand Down Expand Up @@ -126,7 +129,7 @@ public List<CheckpointRecoveryFile> list(@Nullable Predicate<UUID> predicate) th
*/
public void clear() throws StorageException {
File[] files = dir.listFiles(f -> f.isFile()
&& f.getName().contains("-RECOVERY-")
&& f.getName().contains(FILE_NAME_TAG)
&& FILE_NAME_PATTERN.matcher(f.getName()).matches());

for (File file : files) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ class FillRateBasedThrottlingStrategy implements ThrottlingStrategy {
if (cpBufFillRate > cpProgressRate && cpProgressRate < 1d) {
throttlingStarted.set(true);

return (long)(Math.exp(POW * ((cpBufFillRate - cpProgressRate) / (1d - cpProgressRate))) * MIN_THROTTLE_NANOS);
// Normalized checkpoint buffer fill rate on range [cpProgressRate .. 1]. Result value in range [0 .. 1].
double cpBufFillRateNorm = ((cpBufFillRate - cpProgressRate) / (1d - cpProgressRate));

return (long)(Math.exp(POW * cpBufFillRateNorm) * MIN_THROTTLE_NANOS);
}
else
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ public void testRecoverFromCheckpointRecoveryFiles() throws Exception {
max = Math.max(max, cache0.get(i));

// There are two cases possible:
// 1. Failure during put before writting cache entry ta WAL, in this case, after restore we will get last value
// 1. Failure during put before writting cache entry to WAL, in this case, after restore we will get last value
// in cache: val.get() - 1
// 2. Failure during put after writting cache entry ta WAL, in this case, after restore we will get last value
// 2. Failure during put after writting cache entry to WAL, in this case, after restore we will get last value
// in cache: val.get()
assertTrue("Expected value between " + (val.get() - 1) + " and " + val.get() + ", actual value: " + max,
max >= val.get() - 1 && max <= val.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ class DataStorageConfiguration(NamedTuple):
wal_page_compression: str = None
wal_page_compression_level: int = None
wal_path: str = None
write_recovery_data_on_checkpoint: bool = False
write_recovery_data_on_checkpoint: bool = None
checkpoint_recovery_data_compression: str = None
checkpoint_recovery_data_compression_level: int = None

0 comments on commit 9cf9f91

Please sign in to comment.