Akshat-Jain commented on code in PR #16481: URL: https://github.com/apache/druid/pull/16481#discussion_r1608683803
########## extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/output/RetryableS3OutputStream.java: ########## @@ -103,13 +109,35 @@ public class RetryableS3OutputStream extends OutputStream private boolean error; private boolean closed; + /** + * A map to store number of files pending to be uploaded for a given uploadId. + */ + private static final ConcurrentHashMap<String, AtomicInteger> PENDING_FILES = new ConcurrentHashMap<>(); + + /** + * A map containing the lock for a given uploadId used for notifying the main thread about the completion of + * s3.uploadPart() for all chunks for the uploadId, and hence starting the s3.completeMultipartUpload() for + * the uploadId. + */ + private static final ConcurrentHashMap<String, Object> FILE_LOCK_MAP = new ConcurrentHashMap<>(); + + /** + * Semaphore to restrict the maximum number of simultaneous chunks on disk. + */ + private static final int MAX_CONCURRENT_CHUNKS = 10; Review Comment: @cryptoe How should this be configured? Is it fine to keep it constant? Or should we add another config parameter in S3OutputConfig? Thoughts? ########## extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/output/RetryableS3OutputStream.java: ########## @@ -103,13 +109,35 @@ public class RetryableS3OutputStream extends OutputStream private boolean error; private boolean closed; + /** + * A map to store number of files pending to be uploaded for a given uploadId. + */ + private static final ConcurrentHashMap<String, AtomicInteger> PENDING_FILES = new ConcurrentHashMap<>(); + + /** + * A map containing the lock for a given uploadId used for notifying the main thread about the completion of + * s3.uploadPart() for all chunks for the uploadId, and hence starting the s3.completeMultipartUpload() for + * the uploadId. + */ + private static final ConcurrentHashMap<String, Object> FILE_LOCK_MAP = new ConcurrentHashMap<>(); + + /** + * Semaphore to restrict the maximum number of simultaneous chunks on disk. + */ + private static final int MAX_CONCURRENT_CHUNKS = 10; + private static final Semaphore SEMAPHORE = new Semaphore(MAX_CONCURRENT_CHUNKS); + + /** + * Threadpool used for uploading the chunks asynchronously. + */ + private static final ExecutorService UPLOAD_EXECUTOR = Executors.newFixedThreadPool(10); Review Comment: @cryptoe Similar question here: How should the pool size be configured? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
