smengcl opened a new pull request, #11649:
URL: https://github.com/apache/ozone/pull/11649

   Generated-by: Claude Code (Opus 5.5)
   
   ## What changes were proposed in this pull request?
   
   Recon is documented to support SQLite through `ozone.recon.sql.db.driver` 
and `ozone.recon.sql.db.jdbc.url`, but several Derby specific paths break it. 
This PR makes SQLite work out of the box. Derby stays the default; switching 
the default is left to HDDS-16668.
   
   - `ReconControllerModule`: when the JDBC URL contains 
`${ozone.recon.db.dir}`, the whole URL was replaced with a hard coded Derby 
URL. Now only the placeholder is resolved (with the same `ozone.metadata.dirs` 
fallback as the other Recon DBs), so a SQLite URL is kept.
   - `DefaultDataSourceProvider`: pick the provider by the URL scheme 
(`jdbc:derby:` / `jdbc:sqlite:`) instead of a substring match, so a DB path 
containing "derby" does not select the wrong driver.
   - `SqliteDataSourceProvider`: enable WAL and a 60s busy timeout (same as 
Derby's default lock wait timeout). SQLite allows one writer at a time; with 
the default rollback journal a long reader, such as the unhealthy container CSV 
export, blocks all writers until it finishes. WAL lets readers and the writer 
proceed concurrently, and the busy timeout makes writers wait instead of 
failing with `SQLITE_BUSY`. Both are skipped when the URL already sets the 
pragma.
   - `ReconTaskStatusUpdaterManager`: the column check queried Derby's 
`SYS.SYSCOLUMNS` with an upper case column name, which never matched (Derby 
stores the quoted lower case name), so `last_task_run_status` and 
`is_current_task_running` were reset to 0 on every restart, on Derby too. It 
now uses `SqlDbUtils.columnExists` (JDBC metadata), which works on both DBs.
   - `AbstractReconSqlDBTest`: a custom provider passed to the constructor was 
overwritten by the Derby provider in `init()`, so 
`TestReconWithDifferentSqlDBs` never actually ran against SQLite. It now keeps 
the custom provider.
   
   With these changes the full Recon unit test suite passes on SQLite except 
for test side expectations (JDBC type codes, timestamp precision), which are 
handled in HDDS-16668.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-14451
   
   ## How was this patch tested?
   
   New tests:
   - `TestReconWithDifferentSqlDBs#testTaskStatusPreservedOnReload` (Derby and 
SQLite): task status columns survive a reload. Fails without the fix on both 
DBs.
   - `TestReconWithDifferentSqlDBs#testSqliteUsesWalAndBusyTimeout`: WAL and 
busy timeout are set, and a `journal_mode` in the URL is kept.
   - `TestReconWithDifferentSqlDBs#testSqliteSelectedByUrlScheme`: a DB dir 
containing "derby" still gets the SQLite data source.
   - `TestReconUtils#testSqlDbJdbcUrlResolvesReconDbDirPlaceholder`: the 
placeholder resolves to the `ozone.metadata.dirs` fallback.
   
   Recon unit tests pass locally.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-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