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

Merged
merged 18 commits into from
Feb 4, 2025
Merged

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

Copy link
Contributor

mergify bot commented Feb 4, 2025

This pull request is now in conflicts. Could you fix it @khanaffan? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@khanaffan khanaffan merged commit f5485d7 into master Feb 4, 2025
14 checks passed
@khanaffan khanaffan deleted the affanK/ccq-fix branch February 4, 2025 18:34
@khanaffan
Copy link
Contributor Author

@Mergifyio backport release/4.10.x release/4.11.x

Copy link
Contributor

mergify bot commented Feb 4, 2025

backport release/4.10.x release/4.11.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 4, 2025
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
(cherry picked from commit f5485d7)

# Conflicts:
#	common/config/rush/pnpm-lock.yaml
mergify bot pushed a commit that referenced this pull request Feb 4, 2025
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
(cherry picked from commit f5485d7)

# Conflicts:
#	common/config/rush/pnpm-lock.yaml
khanaffan added a commit that referenced this pull request Feb 4, 2025
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
khanaffan added a commit that referenced this pull request Feb 4, 2025
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
aruniverse pushed a commit that referenced this pull request Feb 7, 2025
… [release/4.11.x] (#7655)

Co-authored-by: affank <khanaffan@gmail.com>
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
Co-authored-by: imodeljs-admin <38288322+imodeljs-admin@users.noreply.github.com>
aruniverse added a commit that referenced this pull request Feb 12, 2025
… [release/4.10.x] (#7654)

Co-authored-by: affank <khanaffan@gmail.com>
Co-authored-by: Affan Khan <khanaffan@users.noreply.github.com>
Co-authored-by: imodeljs-admin <38288322+imodeljs-admin@users.noreply.github.com>
Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com>
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