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. #7592

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

khanaffan
Copy link
Contributor

@khanaffan khanaffan commented Jan 22, 2025

imodel-native: iTwin/imodel-native#973

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 }
}

@khanaffan khanaffan marked this pull request as ready for review January 23, 2025 20:55
@khanaffan khanaffan requested review from a team as code owners January 23, 2025 20:55
@khanaffan khanaffan enabled auto-merge (squash) January 31, 2025 21:49
Copy link
Member

@aruniverse aruniverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving addon bump

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.

Concurrent query return INTERRUPT error when preparing ECSQL
6 participants