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

"users-meta failed with compilation_error" when upgrade to 4.8 #9166

Closed
mrjones-plip opened this issue Jun 7, 2024 · 10 comments
Closed

"users-meta failed with compilation_error" when upgrade to 4.8 #9166

mrjones-plip opened this issue Jun 7, 2024 · 10 comments
Assignees
Labels
Affects: 4.7.0 Affects: 4.7.1 Affects: 4.8.0 Regression Affects a feature that worked in a previous release Type: Bug Fix something that isn't working as intended
Milestone

Comments

@mrjones-plip
Copy link
Contributor

mrjones-plip commented Jun 7, 2024

Describe the bug
Due to a new view that was added in 4.7, which requires the newer version of CouchDB, upgrading from any version pre 4.4 to any version post 4.7 will fail

To Reproduce

  1. deploy 4.1
  2. upgrade directly to 4.8
  3. see error

Expected behavior
upgrade should succeed

Logs

2024-06-03 17:46:15 ERROR: Error thrown while installing: Error: Error while saving docs: saving _design/:staged:users-meta failed with compilation_error
    at Object.module.exports.saveDocs (/api/src/db.js:164:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.saveStagedDdocs (/api/src/services/setup/utils.js:258:5)
    at async Object.stage (/api/src/services/setup/upgrade-steps.js:92:3)
    at async safeInstall (/api/src/services/setup/upgrade.js:40:5) {
  [stack]: 'Error: Error while saving docs: saving _design/:staged:users-meta failed with compilation_error\n' +
    '    at Object.module.exports.saveDocs (/api/src/db.js:164:11)\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
    '    at async Object.saveStagedDdocs (/api/src/services/setup/utils.js:258:5)\n' +
    '    at async Object.stage (/api/src/services/setup/upgrade-steps.js:92:3)\n' +
    '    at async safeInstall (/api/src/services/setup/upgrade.js:40:5)',
  [message]: 'Error while saving docs: saving _design/:staged:users-meta failed with compilation_error'
}

Screenshots

Environment

  • Instance: NA
  • Browser: NA
  • Client platform: NA
  • App: NA
  • Version: 4.7+

Additional context
This was discovered upgrading MoH KE and initially a documentation fix was suggested, but instead a patch release is suggested with this ticket

Workaround
The workaround is to upgrade to 4.6.0 (which gets you on to CouchDB 3) and then upgrade to whatever version you want.

@mrjones-plip
Copy link
Contributor Author

cc @dianabarsan @garethbowen @1yuv @derickl

should I add Affects labels for 4.0.0 - 4.7.0?

@garethbowen
Copy link
Member

@mrjones-plip I think it's more important to show as a known issue for the version you're upgrading TO than the version you're upgrading FROM. ie: the affects labels should be from the time the issue was introduced, so 4.7.0 and above.

@garethbowen
Copy link
Member

As part of this we should

  1. make sure our linting protects from future mistakes by treating view code as an older version of es than other code.
  2. raise an issue to remove this limitation in a future version, eg: 5.0.0
  3. raise an issue to make the upgrade more tolerant of failures like this - if this error were ignored and the upgrade continued then everything would work as expected, albeit with a little downtime. This should not block the upgrade.

@mrjones-plip
Copy link
Contributor Author

so 4.7.0 and above

Thannks @garethbowen - added!

@garethbowen
Copy link
Member

garethbowen commented Jun 9, 2024

@mrjones-plip Don't forget our old friend 4.7.1

@mrjones-plip
Copy link
Contributor Author

OMG! How could I possibly forget!? I had to create it, but added.

@garethbowen garethbowen added the Regression Affects a feature that worked in a previous release label Jun 10, 2024
@garethbowen
Copy link
Member

@mrjones-plip I'm about to head on leave - would you mind organising someone to take this on and release 4.7.2 and 4.8.1?

@mrjones-plip
Copy link
Contributor Author

no problem!

@jonathanvq
Copy link

@medic/quality-assurance, this should be on your radar.

dianabarsan added a commit that referenced this issue Jun 17, 2024
Updates new couchdb view to be compatible with Couch 2
Adds test matrix for upgrade tests, to cover upgrades from latest release and from 4.2.4.

#9166
@dianabarsan dianabarsan added this to the 4.7.2 milestone Jun 17, 2024
dianabarsan added a commit that referenced this issue Jun 17, 2024
Updates new couchdb view to be compatible with Couch 2
Adds test matrix for upgrade tests, to cover upgrades from latest release and from 4.2.4.

#9166

(cherry picked from commit 61a04a6)
dianabarsan added a commit that referenced this issue Jun 17, 2024
Updates new couchdb view to be compatible with Couch 2
Adds test matrix for upgrade tests, to cover upgrades from latest release and from 4.2.4.

#9166

(cherry picked from commit 61a04a6)
@dianabarsan
Copy link
Member

Merged to master and backported to 4.7.x and 4.8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects: 4.7.0 Affects: 4.7.1 Affects: 4.8.0 Regression Affects a feature that worked in a previous release Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

4 participants