Refactor SQL enhancer: separate validation from optimization with async support#288
Refactor SQL enhancer: separate validation from optimization with async support#288
Conversation
- Created SqlValidationResult for separate validation - Created OptimizationMode enum (SYNC, ASYNC, DISABLED) - Added validate() method for synchronous validation only - Refactored enhance() to support different optimization modes - Added failed optimization caching to avoid retries - Added async optimization executor for ASYNC mode - Updated metrics to track validation and failures Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
- Added tests for validate() method (valid/invalid SQL) - Added tests for OptimizationMode (DISABLED, SYNC, ASYNC) - Added tests for failed optimization caching - Added test for optimization stats showing mode - All 50 tests passing successfully Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
- Documented why 2 threads are used for async optimization - One thread for immediate processing, one for queued work - Balances responsiveness with resource usage Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
|
@copilot all these options covered: validation can be sync or async? Do we cache the result of validation so next execution don't validate again? optimization can only be enabled if validation is enabled? optimization can be sync and async? optimization caches the result so next time does not validate nor optimize again? if optimization fails does it cache the original query so next time it does not try to validate or optimize again? ( because it already validated and optimization will fail again if it tires) |
Current implementation status:
Key behavior: When |
|
@copilot looks like I incorrectly merged from main and caused a compilation issue, try to fix it by checking my latest commit and verifying what should be the actual merge, focus on the class failing compilation. Make sure code compiles before you push. Make sure the code is compatible with main. [INFO] ------------------------------------------------------------------------ |
- Fixed SqlEnhancerEngine ASYNC block that had incorrect merge conflict resolution - Reverted Java 21 requirements to Java 17 for compatibility - Replaced Thread.ofVirtual() with platform threads in xa-pool-commons - All modules now compile successfully Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Fixed in commit ffd4ee1. The merge from main introduced three issues:
All resolved - code now compiles successfully with Java 17. |
SQL Enhancer Refactoring - Fixed Merge Issues
Merge from main introduced compilation errors that have been resolved:
Fixed Issues
Thread.ofVirtual()(Java 21+ only)Changes Made
Compilation Status
✅ BUILD SUCCESS - all modules compile without errors
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.