ice: Refactored multiple files processing to a separate function.#24
Merged
ice: Refactored multiple files processing to a separate function.#24
Conversation
shyiko
reviewed
Apr 28, 2025
| @@ -0,0 +1,144 @@ | |||
| package com.altinity.ice.internal.cmd; | |||
|
|
|||
| public final class InsertOptions { | |||
| if (retryLog != null) { | ||
| logger.error( | ||
| "{}: error (adding to retry list and continuing)", file, e); | ||
| retryLog.add(file); |
Collaborator
There was a problem hiding this comment.
note to self: retryLog::add is thread-safe so this is fine
| Thread.currentThread().interrupt(); | ||
| throw new IOException("Interrupted while processing files", e); | ||
| } catch (ExecutionException e) { | ||
| if (retryLog == null) { |
Collaborator
There was a problem hiding this comment.
looks like queued up tasks are not canceled;
ExecutorService.close() executed when we exit
try (ExecutorService executor = Executors.newFixedThreadPool(numThreads)) {
on line 157 calls shutdown() (not shutdownNow()), i.e. it's going to block waiting for queued up tasks to complete even though tx won't be committed.
… there is no need to commit transaction.
shyiko
reviewed
Apr 28, 2025
| return new Builder(); | ||
| } | ||
|
|
||
| public boolean skipDuplicates() { |
Collaborator
There was a problem hiding this comment.
all these methods are not needed now that InsertOptions is record (they are present by default)
shyiko
reviewed
Apr 28, 2025
Comment on lines
+207
to
+212
| // Cancel any remaining tasks since we won't commit the transaction | ||
| if (finalOptions.noCommit() || !atLeastOneFileAppended) { | ||
| executor.shutdownNow(); | ||
| } else { | ||
| executor.shutdown(); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| // Cancel any remaining tasks since we won't commit the transaction | |
| if (finalOptions.noCommit() || !atLeastOneFileAppended) { | |
| executor.shutdownNow(); | |
| } else { | |
| executor.shutdown(); | |
| } | |
| executor.shutdownNow(); |
Collaborator
There was a problem hiding this comment.
we should probably awaitTermiantion too (as shutdown/shutdownNow don't do that)
shyiko
approved these changes
Apr 29, 2025
shyiko
added a commit
that referenced
this pull request
May 12, 2025
ice insert: Fix race condition resulting from multiple threads using retryLog.add() without proper synchronization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #2