Skip to content
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

Switch back to SimpleDateFormat from DateTimeFormatter and use ThreadLocal to achieve thread safety instead #14753

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

yashmayya
Copy link
Collaborator

  • Use DateTimeFormatter instead of SimpleDateFormat to resolve thread safety issue in the JDBC client #14723 fixed a concurrency bug in the Pinot JDBC client's date time utils where a single SDF instance could be shared across threads even though it isn't thread safe.
  • However, that patch switched to the newer DateTimeFormatter which isn't backward compatible with the older SimpleDateFormat. Fix JDBC date time parsing issue #14739 attempted to fix some of the incompatibilities but there will always be some edge cases that aren't covered and it is critical to maintain backward compatibility for clients.
  • This patch reverts back to using SimpleDateFormat but with ThreadLocal instead to achieve thread safety. This is more expensive since each thread would need to allocate an instance of SDF but is necessary for thread safety and correctness (as can be demonstrated from the tests added earlier).

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.80%. Comparing base (59551e4) to head (4104ca5).
Report is 1528 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14753      +/-   ##
============================================
+ Coverage     61.75%   63.80%   +2.05%     
- Complexity      207     1608    +1401     
============================================
  Files          2436     2703     +267     
  Lines        133233   150737   +17504     
  Branches      20636    23290    +2654     
============================================
+ Hits          82274    96181   +13907     
- Misses        44911    47351    +2440     
- Partials       6048     7205    +1157     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.79% <100.00%> (+2.08%) ⬆️
java-21 63.69% <100.00%> (+2.07%) ⬆️
skip-bytebuffers-false 63.80% <100.00%> (+2.05%) ⬆️
skip-bytebuffers-true 63.68% <100.00%> (+35.95%) ⬆️
temurin 63.80% <100.00%> (+2.05%) ⬆️
unittests 63.80% <100.00%> (+2.05%) ⬆️
unittests1 56.24% <ø> (+9.35%) ⬆️
unittests2 34.15% <100.00%> (+6.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yashmayya yashmayya merged commit 26ad816 into apache:master Jan 3, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants