Skip to content

[AIPROFVIS-468] Report failed or interrupted SQLite scans instead of returning partial data as success - #1228

Open
dhingora-amd wants to merge 1 commit into
mainfrom
dhingora/sqlite-step-errors
Open

dhingora-amd wants to merge 1 commit into
mainfrom
dhingora/sqlite-step-errors

Conversation

@dhingora-amd

Copy link
Copy Markdown
Contributor

Motivation

Sqlite3Exec stepped rows with while(sqlite3_step(stmt) == SQLITE_ROW) and returned the result of sqlite3_prepare_v2, discarding the codes from sqlite3_step and sqlite3_finalize. A scan that stopped early (SQLITE_INTERRUPT from a cancel, or SQLITE_CORRUPT, SQLITE_IOERR, SQLITE_BUSY, SQLITE_NOMEM) therefore reported success. Slices, tables, level tables and histograms were built from partial data with no error shown, and some of them were saved into the trace's cache tables, so the gaps survived a reopen.

Technical Details

  • Sqlite3Exec keeps the last sqlite3_step result. If the loop ends with anything other than SQLITE_DONE, that code is returned. A callback that stops the loop on purpose still returns its own code, as before.
  • An error from sqlite3_finalize is returned when nothing earlier failed.
  • ExecuteSQLQuery maps SQLITE_INTERRUPT to kRocProfVisDmResultDbAbort, the same as SQLITE_ABORT, so a cancel is reported as a cancel rather than as a database error.
  • Testing:
    • Ran datamodel-system-tests on trace_70b_1024_32.rpd (1099 assertions) and rocpd-transpose.db (561 assertions), and datamodel-compute-tests on rocprof_compute_23ed6f36.db. All pass, with the same results as on main.
    • Built linux-release and opened the RPD sample in the app.

@github-actions

Copy link
Copy Markdown
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

This branch was previously deployed

1 inactive deployment
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.

1 participant