You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "shekhars-li (via GitHub)" <gi...@apache.org> on 2023/08/17 20:48:31 UTC
[GitHub] [samza] shekhars-li commented on a diff in pull request #1682: Fix race condition in ContainerStorageManager
shekhars-li commented on code in PR #1682:
URL: https://github.com/apache/samza/pull/1682#discussion_r1297734327
##########
samza-core/src/main/scala/org/apache/samza/storage/ContainerStorageManager.java:
##########
@@ -319,6 +319,19 @@ private Map<TaskName, Checkpoint> restoreStores() throws InterruptedException {
Map<TaskName, Checkpoint> newTaskCheckpoints = initRestoreAndNewCheckpointFuture.get();
taskCheckpoints.putAll(newTaskCheckpoints);
LOG.debug("Post init and restore checkpoints is: {}. NewTaskCheckpoints are: {}", taskCheckpoints, newTaskCheckpoints);
+ // Stop all persistent stores after restoring. Certain persistent stores opened in BulkLoad mode are compacted
+ // on stop, so paralleling stop() also parallelizes their compaction (a time-intensive operation).
Review Comment:
You're right. Fixed it by calling taskRestoreManager.close() after each taskRestoreManager.restore() completes (with or without expcetion). Also added test to verify that the close is not prematurely called.
##########
samza-core/src/main/scala/org/apache/samza/storage/ContainerStorageManager.java:
##########
@@ -319,6 +319,19 @@ private Map<TaskName, Checkpoint> restoreStores() throws InterruptedException {
Map<TaskName, Checkpoint> newTaskCheckpoints = initRestoreAndNewCheckpointFuture.get();
taskCheckpoints.putAll(newTaskCheckpoints);
LOG.debug("Post init and restore checkpoints is: {}. NewTaskCheckpoints are: {}", taskCheckpoints, newTaskCheckpoints);
+ // Stop all persistent stores after restoring. Certain persistent stores opened in BulkLoad mode are compacted
+ // on stop, so paralleling stop() also parallelizes their compaction (a time-intensive operation).
Review Comment:
Thanks, you're right. Fixed it by calling taskRestoreManager.close() after each taskRestoreManager.restore() completes (with or without expcetion). Also added test to verify that the close is not prematurely called.
--
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: commits-unsubscribe@samza.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org