Skip to content

Commit

Permalink
Issue 5673: (SLTS) Fix wrong GC config (pravega#5674)
Browse files Browse the repository at this point in the history
Changed SLTS GC time unit from seconds to milliseconds. Also changed the level of some log messages to reduce noise.

Signed-off-by: Sachin Joshi <sachin.joshi@emc.com>
  • Loading branch information
sachin-j-joshi authored and co-jo committed Feb 16, 2021
1 parent 737ac17 commit 6f20300
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class ChunkedSegmentStorageConfig {
public static final Property<Integer> GARBAGE_COLLECTION_DELAY = Property.named("garbage.collection.delay.seconds", 60);
public static final Property<Integer> GARBAGE_COLLECTION_MAX_CONCURRENCY = Property.named("garbage.collection.concurrency.max", 10);
public static final Property<Integer> GARBAGE_COLLECTION_MAX_QUEUE_SIZE = Property.named("garbage.collection.queue.size.max", 16 * 1024);
public static final Property<Integer> GARBAGE_COLLECTION_SLEEP = Property.named("garbage.collection.sleep.seconds", 60);
public static final Property<Integer> GARBAGE_COLLECTION_MAX_ATTEMPS = Property.named("garbage.collection.attempts.max", 3);
public static final Property<Integer> GARBAGE_COLLECTION_SLEEP = Property.named("garbage.collection.sleep.millis", 10);
public static final Property<Integer> GARBAGE_COLLECTION_MAX_ATTEMPTS = Property.named("garbage.collection.attempts.max", 3);


/**
Expand All @@ -63,7 +63,7 @@ public class ChunkedSegmentStorageConfig {
.garbageCollectionDelay(Duration.ofSeconds(60))
.garbageCollectionMaxConcurrency(10)
.garbageCollectionMaxQueueSize(16 * 1024)
.garbageCollectionSleep(Duration.ofSeconds(60))
.garbageCollectionSleep(Duration.ofMillis(10))
.garbageCollectionMaxAttempts(3)
.build();

Expand Down Expand Up @@ -191,8 +191,8 @@ public class ChunkedSegmentStorageConfig {
this.garbageCollectionDelay = Duration.ofSeconds(properties.getInt(GARBAGE_COLLECTION_DELAY));
this.garbageCollectionMaxConcurrency = properties.getInt(GARBAGE_COLLECTION_MAX_CONCURRENCY);
this.garbageCollectionMaxQueueSize = properties.getInt(GARBAGE_COLLECTION_MAX_QUEUE_SIZE);
this.garbageCollectionSleep = Duration.ofSeconds(properties.getInt(GARBAGE_COLLECTION_SLEEP));
this.garbageCollectionMaxAttempts = properties.getInt(GARBAGE_COLLECTION_MAX_ATTEMPS);
this.garbageCollectionSleep = Duration.ofMillis(properties.getInt(GARBAGE_COLLECTION_SLEEP));
this.garbageCollectionMaxAttempts = properties.getInt(GARBAGE_COLLECTION_MAX_ATTEMPTS);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,11 @@ protected CompletableFuture<Void> doRun() {
loopFuture = Futures.loop(
this::canRun,
() -> delaySupplier.get()
.thenRunAsync(() -> {
log.info("{}: Iteration {} started.", traceObjectId, iterationId.get());
}, executor)
.thenComposeAsync(v -> deleteGarbage(true, config.getGarbageCollectionMaxConcurrency()), executor)
.handleAsync((v, ex) -> {
if (null != ex) {
log.error("{}: Error during doRun.", traceObjectId, ex);
}
log.info("{}: Iteration {} ended.", traceObjectId, iterationId.getAndIncrement());
return null;
}, executor),
executor);
Expand Down Expand Up @@ -240,7 +236,7 @@ void addToGarbage(String chunkToDelete, long startTime, int attempts) {
* @return CompletableFuture which is completed when garbage is deleted.
*/
CompletableFuture<Boolean> deleteGarbage(boolean isBackground, int maxItems) {
log.debug("{}: deleteGarbage - started.", traceObjectId);
log.debug("{}: Iteration {} started.", traceObjectId, iterationId.get());
// Sleep if suspended.
if (suspended.get() && isBackground) {
log.info("{}: deleteGarbage - suspended - sleeping for {}.", traceObjectId, config.getGarbageCollectionDelay());
Expand Down Expand Up @@ -351,7 +347,7 @@ CompletableFuture<Boolean> deleteGarbage(boolean isBackground, int maxItems) {
}
return Futures.allOf(futures)
.thenApplyAsync( v -> {
log.debug("{}: deleteGarbage - finished.", traceObjectId);
log.debug("{}: Iteration {} ended.", traceObjectId, iterationId.getAndIncrement());
return true;
}, executor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testProvidedValues() {
props.setProperty(ChunkedSegmentStorageConfig.GARBAGE_COLLECTION_MAX_QUEUE_SIZE.getFullName(ChunkedSegmentStorageConfig.COMPONENT_CODE), "10");
props.setProperty(ChunkedSegmentStorageConfig.GARBAGE_COLLECTION_MAX_CONCURRENCY.getFullName(ChunkedSegmentStorageConfig.COMPONENT_CODE), "11");
props.setProperty(ChunkedSegmentStorageConfig.GARBAGE_COLLECTION_SLEEP.getFullName(ChunkedSegmentStorageConfig.COMPONENT_CODE), "12");
props.setProperty(ChunkedSegmentStorageConfig.GARBAGE_COLLECTION_MAX_ATTEMPS.getFullName(ChunkedSegmentStorageConfig.COMPONENT_CODE), "13");
props.setProperty(ChunkedSegmentStorageConfig.GARBAGE_COLLECTION_MAX_ATTEMPTS.getFullName(ChunkedSegmentStorageConfig.COMPONENT_CODE), "13");

TypedProperties typedProperties = new TypedProperties(props, "storage");
ChunkedSegmentStorageConfig config = new ChunkedSegmentStorageConfig(typedProperties);
Expand All @@ -55,7 +55,7 @@ public void testProvidedValues() {
Assert.assertEquals(config.getGarbageCollectionDelay().toSeconds(), 9);
Assert.assertEquals(config.getGarbageCollectionMaxQueueSize(), 10);
Assert.assertEquals(config.getGarbageCollectionMaxConcurrency(), 11);
Assert.assertEquals(config.getGarbageCollectionSleep().toSeconds(), 12);
Assert.assertEquals(config.getGarbageCollectionSleep().toMillis(), 12);
Assert.assertEquals(config.getGarbageCollectionMaxAttempts(), 13);
}

Expand Down

0 comments on commit 6f20300

Please sign in to comment.