-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove exception on failure response from GCS delete API #16047
Remove exception on failure response from GCS delete API #16047
Conversation
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Abhishek Radhakrishnan <[email protected]>
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
if (!storage.get().delete(bucket, path)) { | ||
throw new IOE( | ||
"Failed deleting google cloud storage object [bucket: %s path: %s]", | ||
log.warn(StringUtils.nonStrictFormat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it was debug previously, lets keep it at debug level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this is not to spook existing users when they suddenly start seeing warn for missing descriptor.json. Else it better be visible to spot logic bugs.
{ | ||
List<Boolean> statuses = storage.get().delete(Iterables.transform(paths, input -> BlobId.of(bucket, input))); | ||
if (statuses.contains(false)) { | ||
throw new IOE("Failed deleting google cloud storage object(s)"); | ||
log.warn("Google cloud storage object(s) to be deleted not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be debug level as well. Also please log the paths and bucket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed and included.
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Show resolved
Hide resolved
@@ -70,12 +70,12 @@ public void kill(DataSegment segment) throws SegmentLoadingException | |||
// anymore, but we still delete them if exists. | |||
deleteIfPresent(bucket, descriptorPath); | |||
} | |||
catch (IOException e) { | |||
catch (StorageException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteIfPresent
no longer throws IOException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the underlying lib could still throw an IOException though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it can't -- else it has to be caught or declared thrown since it's a checked exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could add IOException too here so that any random IO error is bubbled up as SegmentLoadingException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently wIth retry, only 2 exception kinds are possible: a) Exception raised by the retried call (only StorageException in this case), and b) RuntimeException.
druid/processing/src/main/java/org/apache/druid/java/util/common/RetryUtils.java
Line 140 in bf39c71
Throwables.propagateIfInstanceOf(e, Exception.class); |
Do we still want to include IOException handling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. probably ok to leave.
* change runtime exception class for code coverage * Add file paths for batch delete failures
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Show resolved
Hide resolved
...google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Show resolved
Hide resolved
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Outdated
Show resolved
Hide resolved
...-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java
Outdated
Show resolved
Hide resolved
...ns-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleUtilsTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @abhishekagarwal87 and @abhishekrb19 for the thorough reviews!
...google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Show resolved
Hide resolved
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the comments swiftly, @gargvishesh! I finished my review of the tests and left a few comments along with some nits, but otherwise looks good.
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Outdated
Show resolved
Hide resolved
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Outdated
Show resolved
Hide resolved
...le-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java
Show resolved
Hide resolved
...-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java
Show resolved
Hide resolved
...-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java
Outdated
Show resolved
Hide resolved
...-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java
Outdated
Show resolved
Hide resolved
...-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java
Outdated
Show resolved
Hide resolved
...core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleTaskLogsTest.java
Outdated
Show resolved
Hide resolved
...ns-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleUtilsTest.java
Show resolved
Hide resolved
...ions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleStorage.java
Outdated
Show resolved
Hide resolved
* Throw 404 Exception on failure response from GCS delete API * Replace String.format * Apply suggestions from code review Co-authored-by: Abhishek Radhakrishnan <[email protected]> * Remove exception for file not found and fix tests * Add warn log and fix intellij inspection errors * More intellij inspection fixes * * Change to debug log * change runtime exception class for code coverage * Add file paths for batch delete failures * Move failedPaths computation to inside isDebugEnabled flag * Correct handling of StorageException * Address review comments * Remove unused exceptions * Address code coverage and review comments * Minor corrections --------- Co-authored-by: Abhishek Radhakrishnan <[email protected]> (cherry picked from commit bed5d9c)
* Throw 404 Exception on failure response from GCS delete API * Replace String.format * Apply suggestions from code review Co-authored-by: Abhishek Radhakrishnan <[email protected]> * Remove exception for file not found and fix tests * Add warn log and fix intellij inspection errors * More intellij inspection fixes * * Change to debug log * change runtime exception class for code coverage * Add file paths for batch delete failures * Move failedPaths computation to inside isDebugEnabled flag * Correct handling of StorageException * Address review comments * Remove unused exceptions * Address code coverage and review comments * Minor corrections --------- Co-authored-by: Abhishek Radhakrishnan <[email protected]> (cherry picked from commit bed5d9c)
…6095) * Throw 404 Exception on failure response from GCS delete API * Replace String.format * Apply suggestions from code review Co-authored-by: Abhishek Radhakrishnan <[email protected]> * Remove exception for file not found and fix tests * Add warn log and fix intellij inspection errors * More intellij inspection fixes * * Change to debug log * change runtime exception class for code coverage * Add file paths for batch delete failures * Move failedPaths computation to inside isDebugEnabled flag * Correct handling of StorageException * Address review comments * Remove unused exceptions * Address code coverage and review comments * Minor corrections --------- Co-authored-by: Abhishek Radhakrishnan <[email protected]> (cherry picked from commit bed5d9c)
Caused because of : #15398 |
The previously used
Google API Client
library for Google Cloud Storage returned a 404 HTTPResponseException fordelete
when the object to be deleted was not found, and was propagated as-is by the Druid GCS extension. The currently usedGoogle Cloud Client
library just returns afalse
response in that scenario, which was being converted to a genericIOException
in the extension -- breaking flows where file missing is an acceptable behaviour.This PR removes the exception altogether since all current delete scenarios don't care if the file-to-be-deleted is missing