Skip to content

Instantly share code, notes, and snippets.

@hanohrs
Created May 1, 2024 10:11
Show Gist options
  • Save hanohrs/db1ac43a010e2958f3eee036bc35a5fc to your computer and use it in GitHub Desktop.
Save hanohrs/db1ac43a010e2958f3eee036bc35a5fc to your computer and use it in GitHub Desktop.
Manual revert of 0cc81db
diff --git a/h2/src/main/org/h2/mvstore/RandomAccessStore.java b/h2/src/main/org/h2/mvstore/RandomAccessStore.java
index dbf2ee378..61d4e3f23 100644
--- a/h2/src/main/org/h2/mvstore/RandomAccessStore.java
+++ b/h2/src/main/org/h2/mvstore/RandomAccessStore.java
@@ -43,7 +43,6 @@ public abstract class RandomAccessStore extends FileStore<SFChunk>
private long reservedLow;
private long reservedHigh;
- private boolean stopIdleHousekeeping;
public RandomAccessStore(Map<String, Object> config) {
super(config);
@@ -704,12 +703,8 @@ private void shrinkIfPossible(int minPercent) {
protected void doHousekeeping(MVStore mvStore) throws InterruptedException {
boolean idle = isIdle();
int rewritableChunksFillRate = getRewritableChunksFillRate();
- if (idle && stopIdleHousekeeping) {
- return;
- }
int autoCommitMemory = mvStore.getAutoCommitMemory();
int fileFillRate = getFillRate();
- long chunksTotalSize = size() * fileFillRate / 100;
if (isFragmented() && fileFillRate < getAutoCompactFillRate()) {
mvStore.tryExecuteUnderStoreLock(() -> {
int moveSize = 2 * autoCommitMemory;
@@ -721,7 +716,6 @@ protected void doHousekeeping(MVStore mvStore) throws InterruptedException {
});
}
- int chunksFillRate = getChunksFillRate();
int adjustedUpFillRate = 50 + rewritableChunksFillRate / 2;
int fillRateToCompare = idle ? rewritableChunksFillRate : adjustedUpFillRate;
if (fillRateToCompare < getTargetFillRate(idle)) {
@@ -737,13 +731,6 @@ protected void doHousekeeping(MVStore mvStore) throws InterruptedException {
return true;
});
}
- stopIdleHousekeeping = false;
- if (idle) {
- int currentChunksFillRate = getChunksFillRate();
- long currentTotalChunksSize = size() * getFillRate() / 100;
- stopIdleHousekeeping = currentTotalChunksSize > chunksTotalSize
- || currentTotalChunksSize == chunksTotalSize && currentChunksFillRate <= chunksFillRate;
- }
}
private int getTargetFillRate(boolean idle) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment