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: Prevent fallback to existing jobs index #2644

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

taratatach
Copy link
Member

The in-progress jobs query for the export feature relies on the
presence of a very specific index to be fast on cozies with a lot of
io.cozy.jobs documents.

To make sure the index presence detection goes well, we forced a sort
on the worker attribute.
However, since cozy-stack uses an index on worker and state
only, CouchDB fallbacks to this index instead of detecting the index
we want does not exist and runs the slow $or query in-memory.
See apache/couchdb#4511 for more details on
this issue.

To prevent this fallback we will sort on a second attribute not present
in the existing cozy-stack index: message.slug.

### 🐛 Bug Fixes

* Prevent fallback on sub-optimal index for in-progress jobs query.

@taratatach taratatach self-assigned this Apr 4, 2023
@bundlemon
Copy link

bundlemon bot commented Apr 4, 2023

BundleMon

Files updated (1)
Status Path Size Limits
main.bundle.js
208.36KB (+14B +0.01%) -
Unchanged files (46)
Status Path Size Limits
screenshots/fr/screenshot4.png
1.29MB -
screenshots/en/screenshot4.png
1.28MB -
vendors.bundle.js
1.18MB -
screenshots/fr/screenshot5.png
1.17MB -
screenshots/en/screenshot5.png
1.17MB -
categorization.js
1.09MB -
onOperationOrBillCreate.js
1.08MB -
recurrence.js
1.06MB -
konnectorAlerts.js
1.06MB -
budgetAlerts.js
1.04MB -
autogroups.js
462.42KB -
linkMyselfToAccounts.js
462.39KB -
screenshots/fr/screenshot1.png
330.32KB -
screenshots/en/screenshot1.png
311.39KB -
screenshots/fr/screenshot2.png
264.27KB -
screenshots/en/screenshot2.png
256.24KB -
screenshots/fr/screenshot3.png
246.98KB -
screenshots/en/screenshot3.png
243.76KB -
img/veepee-info.43d778410d97b8e73b4eb07bb4631
d74.png
173.24KB -
img/veepee-info@2x.e00642b6164d2b110ebd6a1443
9fcda5.png
167.13KB -
img/ameli-side.7173251188c5fe0d8d54e265f8426a
89.png
115.29KB -
cozy-bar.bundle.js
34.46KB -
vendors-banks.(hash).(hash).min.css
31.64KB -
img/veepee.9d3db3d18a5534582eba5b9fdbddb8bf.p
ng
25.01KB -
img/transfer-error.81739cda73db9309b4f58bf975
ee3856.jpg
24.69KB -
main-banks.(hash).min.css
16.18KB -
img/transfer-done.952c792c91ee5a8b70e025e85bf
4938a.jpg
13.95KB -
icon-banks.jpg
8.09KB -
img/icon-banks.3b21dff3d03e7f0b319fb93b5c5417
84.jpg
8.09KB -
img/search-illu.4536cb0962f2010e397bb96aeed5b
415.svg
4.48KB -
img/timeline_desktop_fr.8a2f9796b9d34fdc21eec
489d2f16db1.svg
3.94KB -
img/timeline_mobile_fr.e42a3b60dcefcdbae40e44
9c49c01d83.svg
3.83KB -
img/timeline_mobile_en.0f4ace6755128e27a825e0
31b0480a71.svg
3.66KB -
img/timeline_desktop_en.8ed0e7248216da5fb042e
30314036a39.svg
3.51KB -
mesinfos/favicon-32x32.png
1.39KB -
mesinfos/favicon.ico
1.19KB -
mesinfos/favicon-16x16.png
1.11KB -
index.html
1.07KB -
img/NoAccount.5cd307dbe22ac700d2f570f2c33487e
3.svg
1021B -
mesinfos/icon-bank.svg
645B -
img/pie-demo.5d713502666ac766dddccd37e34b0089
.svg
449B -
favicon-32x32.png
242B -
public/safari-pinned-tab.svg
229B -
favicon-16x16.png
216B -
icon-banks.svg
191B -
img/icon-banks.9c3bc95f679ee29ae4b2b3f9fda178
37.svg
191B -

Total files change +14B 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

  The in-progress jobs query for the export feature relies on the
  presence of a very specific index to be fast on cozies with a lot of
  `io.cozy.jobs` documents.

  To make sure the index presence detection goes well, we forced a sort
  on the `worker` attribute.
  However, since `cozy-stack` uses an index on `worker` and `state`
  only, CouchDB fallbacks to this index instead of detecting the index
  we want does not exist and runs the slow `$or` query in-memory.
  See apache/couchdb#4511 for more details on
  this issue.

  To prevent this fallback we will sort on a second attribute not present
  in the existing `cozy-stack` index: `message.slug`.
@taratatach taratatach force-pushed the fix/avoid-fallback-to-existing-jobs-index branch from 97ebd8b to b9ef628 Compare April 5, 2023 07:42
@taratatach taratatach merged commit 252a3f6 into master Apr 5, 2023
@taratatach taratatach deleted the fix/avoid-fallback-to-existing-jobs-index branch April 5, 2023 08:35
taratatach added a commit that referenced this pull request Apr 5, 2023
Backport of #2644 

The in-progress jobs query for the export feature relies on the
presence of a very specific index to be fast on cozies with a lot of
`io.cozy.jobs` documents.

To make sure the index presence detection goes well, we forced a sort
on the `worker` attribute.
However, since `cozy-stack` uses an index on `worker` and `state`
only, CouchDB fallbacks to this index instead of detecting the index
we want does not exist and runs the slow `$or` query in-memory.
See apache/couchdb#4511 for more details on
this issue.

To prevent this fallback we will sort on a second attribute not present
in the existing `cozy-stack` index: `message.slug`.

```
### 🐛 Bug Fixes

* Prevent fallback on sub-optimal index for in-progress jobs query.
```
taratatach added a commit that referenced this pull request Apr 5, 2023
Backport of #2644 

The in-progress jobs query for the export feature relies on the
presence of a very specific index to be fast on cozies with a lot of
`io.cozy.jobs` documents.

To make sure the index presence detection goes well, we forced a sort
on the `worker` attribute.
However, since `cozy-stack` uses an index on `worker` and `state`
only, CouchDB fallbacks to this index instead of detecting the index
we want does not exist and runs the slow `$or` query in-memory.
See apache/couchdb#4511 for more details on
this issue.

To prevent this fallback we will sort on a second attribute not present
in the existing `cozy-stack` index: `message.slug`.

```
### 🐛 Bug Fixes

* Prevent fallback on sub-optimal index for in-progress jobs query.
```
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.

2 participants