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

Fix issue where query get interrupted during prepare. (backport #7592) [release/4.10.x] #7654

Open
wants to merge 3 commits into
base: release/4.10.x
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 4, 2025

imodel-native: iTwin/imodel-native#989

Fixes: #7549

  • Do not interrupt the query during preparation. The query can only be interrupted during the step() function.
  • Add an option to prepare ECSQL using a thread database connection. Experimental.
    • Default to false. Not enabled.
    • Thread does not wait to acquire lock on primary connection to prepare statement. Enhance faster.
    • Side effect more memory as each connection load its on EC Schema when preparing ECSQL.
  • Query statistics now also return preparation time in nanoseconds.
  • Introduce a feature to automatically shut down concurrent queries when idle for a set time:
    • Defaults to 30 minutes.
    • Closes all threads and releases resources used by concurrent queries.
    • Automatically wakes up when a new request comes in.
    • New error code is added ShuttingDown which cause frontend to retry.
  • Allow setting the memory map I/O size for each connection, defaulting to 0 (not used):
    • This is an experimental option. It improves query performance on regular files but is untested with cloud SQLite.
  • The statement cache size per thread can now be configured, with the default remaining at 40 (unchanged from previous).
  • Fix a issue where delay use for testing cause every query to delay at least once even when not testing.
  • Added allowTestingArgs help simulate a condition for testing.
  • Found another issue which cause thread dead lock during closing connection. ConcurrentQuery config is not stored on db connection anymore.
    The default config look as following. Only new change is autoShutdowWhenIdealForSeconds: 1800
{
  workerThreads: 4,
  requestQueueSize: 2000,
  ignorePriority: false,
  ignoreDelay: true,
  doNotUsePrimaryConnToPrepare: false,
  autoShutdowWhenIdlelForSeconds: 1800,
  statementCacheSizePerWorker: 40,
  monitorPollInterval: 1000,
  memoryMapFileSize: 0,
  allowTestingArgs: false,
  globalQuota: { time: 60, memory: 8388608 }
}

This is an automatic backport of pull request #7592 done by [Mergify](https://mergify.com).

Co-authored-by: Affan Khan <[email protected]>
(cherry picked from commit f5485d7)

# Conflicts:
#	common/config/rush/pnpm-lock.yaml
@mergify mergify bot added the conflicts label Feb 4, 2025
@mergify mergify bot requested review from a team as code owners February 4, 2025 19:39
Copy link
Contributor Author

mergify bot commented Feb 4, 2025

Cherry-pick of f5485d7 has failed:

On branch mergify/bp/release/4.10.x/pr-7592
Your branch is up to date with 'origin/release/4.10.x'.

You are currently cherry-picking commit f5485d7139.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   common/api/core-common.api.md
	modified:   common/api/summary/core-common.exports.csv
	new file:   common/changes/@itwin/core-backend/affank-ccq-fix_2025-01-22-22-18.json
	new file:   common/changes/@itwin/core-common/affank-ccq-fix_2025-01-22-22-18.json
	new file:   core/backend/src/test/ecdb/ConcurrentQueryLoad.test.ts
	modified:   core/backend/src/test/ecdb/ECSqlQuery.test.ts
	modified:   core/common/src/ConcurrentQuery.ts
	modified:   core/common/src/ECSqlReader.ts

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   common/config/rush/pnpm-lock.yaml

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@aruniverse
Copy link
Member

@DanRod1999 any idea what happened to the native addon here?

@DanRod1999
Copy link
Contributor

windows build failed on addon release. Rerunning build now. Should be transient since the PR itself merged, however it is the same compiler error I've been getting in my other BP pr. I think its a coincidence, but a little alarming to see it keep popping up.

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.

7 participants