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

indexeddb: Clear the object store before deleting it #3090

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

andybalaam
Copy link
Member

Since my investigation found that it significantly speeds up deletion of a store on both Firefox and Chromium if you clear() it first, do that in our migration code.

Related: element-hq/element-web#26948

@andybalaam andybalaam changed the title indexeddb: Clear a store before deleting it indexeddb: Clear the object store before deleting it Feb 2, 2024
Since my investigation found that it significantly speeds up deletion of
a store on both Firefox and Chromium if you clear() it first, do that in
our migration code.
@andybalaam andybalaam force-pushed the andybalaam/indexeddb-clear-store-before-delete branch from 124c9eb to 916e85f Compare February 2, 2024 14:06
@andybalaam andybalaam marked this pull request as ready for review February 2, 2024 14:06
@andybalaam andybalaam requested a review from a team as a code owner February 2, 2024 14:06
@andybalaam andybalaam requested review from bnjbvr and removed request for a team February 2, 2024 14:06
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (40e0066) 83.71% compared to head (916e85f) 83.71%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3090   +/-   ##
=======================================
  Coverage   83.71%   83.71%           
=======================================
  Files         224      224           
  Lines       23497    23497           
=======================================
  Hits        19671    19671           
  Misses       3826     3826           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Makes sense.

@andybalaam andybalaam merged commit b9ef5d6 into main Feb 2, 2024
36 checks passed
@andybalaam andybalaam deleted the andybalaam/indexeddb-clear-store-before-delete branch February 2, 2024 14:50
andybalaam added a commit to matrix-org/matrix-rust-sdk-crypto-wasm that referenced this pull request Feb 5, 2024
Including getting the latest matrix-rust-sdk, providing:

* [indexeddb: Clear the object store before deleting it #3090](matrix-org/matrix-rust-sdk#3090)

which speeds up the schema upgrade v8 to v10 (see
element-hq/element-web#26948 ).
@@ -317,6 +317,11 @@ async fn prepare_data_for_v7(serializer: &IndexeddbSerializer, db: &IdbDatabase)
}
}

// We have finished with the old store. Clear it, since it is faster to
// clear+delete than just delete. See https://www.artificialworlds.net/blog/2024/02/01/deleting-an-indexed-db-store-can-be-incredibly-slow-on-firefox/
Copy link
Member

Choose a reason for hiding this comment

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

This link is a 404 :-).

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in #3094

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.

4 participants