gianm opened a new pull request, #19218:
URL: https://github.com/apache/druid/pull/19218

   The main improvement is that "persist" is moved out of a finally block, and 
now only happens on the normal path. This has two benefits. First, there is no 
point in persisting on the error path, and the in-memory index might be in a 
bad state anyway at that point. Second, moving the persist call out of 
"finally" fixes an issue where an exception thrown from "persist" would cause 
an exception thrown from "add" to be lost.
   
   This can come up in production when the in-memory index grows too large, 
causing the main code to throw an OutOfMemoryError, and then something goes 
wrong with the persist too. In this situation the original OutOfMemoryError 
would not have been logged.
   
   A secondary improvement is that we catch Throwable rather than Exception to 
trigger cleanup and when handling errors that occur during cleanup. This 
ensures we don't miss cleanup tasks when an Error is thrown by the main code, 
and that we don't lose the original exception if an Error is thrown by the 
cleanup code.


-- 
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]

Reply via email to