Remove exception on failure response from GCS delete API#16047
Remove exception on failure response from GCS delete API#16047abhishekrb19 merged 14 commits intoapache:masterfrom
Conversation
Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com>
| 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.
since it was debug previously, lets keep it at debug level
There was a problem hiding this comment.
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.
it can be debug level as well. Also please log the paths and bucket
There was a problem hiding this comment.
Changed and included.
| deleteIfPresent(bucket, descriptorPath); | ||
| } | ||
| catch (IOException e) { | ||
| catch (StorageException e) { |
There was a problem hiding this comment.
deleteIfPresent no longer throws IOException
There was a problem hiding this comment.
the underlying lib could still throw an IOException though?
There was a problem hiding this comment.
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.
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.
Currently wIth retry, only 2 exception kinds are possible: a) Exception raised by the retried call (only StorageException in this case), and b) RuntimeException.
Do we still want to include IOException handling?
There was a problem hiding this comment.
Hmm. probably ok to leave.
* change runtime exception class for code coverage * Add file paths for batch delete failures
gargvishesh
left a comment
There was a problem hiding this comment.
Thank you @abhishekagarwal87 and @abhishekrb19 for the thorough reviews!
abhishekrb19
left a comment
There was a problem hiding this comment.
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.
* Throw 404 Exception on failure response from GCS delete API * Replace String.format * Apply suggestions from code review Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com> * 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 <abhishek.rb19@gmail.com> (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 <abhishek.rb19@gmail.com> * 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 <abhishek.rb19@gmail.com> (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 <abhishek.rb19@gmail.com> * 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 <abhishek.rb19@gmail.com> (cherry picked from commit bed5d9c)
|
Caused because of : #15398 |
The previously used
Google API Clientlibrary for Google Cloud Storage returned a 404 HTTPResponseException fordeletewhen the object to be deleted was not found, and was propagated as-is by the Druid GCS extension. The currently usedGoogle Cloud Clientlibrary just returns afalseresponse in that scenario, which was being converted to a genericIOExceptionin 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