kfaraz commented on code in PR #16481:
URL: https://github.com/apache/druid/pull/16481#discussion_r1609581399
##########
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/output/RetryableS3OutputStream.java:
##########
@@ -199,15 +211,47 @@ private void pushCurrentChunk() throws IOException
{
currentChunk.close();
final Chunk chunk = currentChunk;
- try {
- if (chunk.length() > 0) {
- resultsSize += chunk.length();
+ if (chunk.length() > 0) {
+ try {
+ SEMAPHORE.acquire(); // Acquire a permit from the semaphore
Review Comment:
No, you can retain the `wait` and `notify` flow, but the condition that you
are waiting on becomes the available disk space, which is what we really care
about in the first place (unless there is any other condition that we want to
wait on).
It could look something like this:
In `write()`:
```
synchronized(diskSpaceAvailableLock) {
while (availableDiskSpace < sizeToWrite) {
diskSpaceAvailableLock.wait();
}
}
```
After upload and delete:
```
synchronized(diskSpaceAvailable) {
// update availableDiskSpace
diskspaceAvailableLock.notifyAll();
}
```
--
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]