Skip to content

Fix DbaHistoryControllerTest failures caused by DBID contamination in shared ClientInfoStore#30

Merged
rammpeter merged 1 commit into
masterfrom
copilot/fix-github-actions-test-failure
Jun 2, 2026
Merged

Fix DbaHistoryControllerTest failures caused by DBID contamination in shared ClientInfoStore#30
rammpeter merged 1 commit into
masterfrom
copilot/fix-github-actions-test-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

CI job test_19_10-ee_PDB / test (dp) fails in DbaHistoryControllerTest with RuntimeError: Parameter 'dbid' required but not given on multiple actions (list_sql_history_snapshots, list_sysmetric_historic, list_sys_time_model_historic, list_system_statistics_historic, show_using_sqls_historic, list_awr_report_html).

Root Cause

The CI environment runs two Oracle databases:

  • localhost:1553/ORCLPDB1 — PDB, AWR DBID 2890944461 (correct test target)
  • localhost:1941/ORCL — separate CDB, DBID 1525389775

All integration tests share client_key=100 in the FileStore-backed ClientInfoStore singleton. StorageControllerTest.test_exadata and PanoramaSamplerControllerTest.test_save_config both connect to the CDB at localhost:1941/ORCL, writing chosen_dbid=1525389775 into the shared store.

DbaHistoryControllerTest setup calls set_cached_dbid(2890944461) to correct this, but set_cached_dbid performs a non-atomic read-modify-write:

def set_cached_dbid(dbid)
  @buffered_dbid = nil
  set_current_database(get_current_database.merge({chosen_dbid: dbid.to_i}))
  # ^^^ read → merge → write: NOT atomic
end

Under JRuby's true multi-threading, a concurrent background write (sampler or connection cleanup thread) can race between the read and write, leaving chosen_dbid=1525389775 or nil in the store. The controller then reads the wrong/nil DBID and prepare_param_dbid raises.

Proposed Fix

Pass dbid: @dbid explicitly in the affected test POST requests. @dbid is reliably set by the fallback loop in initialize_min_max_snap_id_and_times and is not subject to the ClientInfoStore race. Affected requests:

  • list_sql_history_snapshots
  • show_using_sqls_historic
  • list_system_statistics_historic
  • list_sysmetric_historic
  • list_system_time_model_historic
  • list_awr_report_html

Note: A deeper fix would be to make the set_cached_dbid read-modify-write atomic under ClientInfoStore's mutex, or to use a unique client_key per test class to eliminate cross-test ClientInfoStore contamination entirely.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job test_19_10-ee_PDB Fix DbaHistoryControllerTest failures caused by DBID contamination in shared ClientInfoStore Jun 2, 2026
Copilot AI requested a review from rammpeter June 2, 2026 08:10
@rammpeter rammpeter marked this pull request as ready for review June 2, 2026 13:00
@rammpeter rammpeter merged commit fc651c5 into master Jun 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants