Skip to content

Commit 7332bf1

Browse files
committed
Gracefully handle double removal of version 0 attributes index.
1 parent 43d51af commit 7332bf1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# bedrock-edv-storage ChangeLog
22

3+
## 20.1.1 - 2025-04-dd
4+
5+
### Fixed
6+
- Gracefully handle case where `documentCompatibilityVersion` is set to `1`
7+
and concurrent processes try to remove the old version `0` index (this
8+
should not cause the application to restart once).
9+
310
## 20.1.0 - 2025-04-22
411

512
### Added

lib/storage/docs.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,15 @@ export async function _handleDocumentCompatibility({
530530
// then version `0` documents may be concurrently inserted and fail to be
531531
// properly indexed w/o running migration again -- this can lead to
532532
// corruption and should never be allowed to happen
533-
await collection.dropIndex('attributes');
533+
try {
534+
await collection.dropIndex('attributes');
535+
} catch(error) {
536+
if(error.codeName !== 'IndexNotFound') {
537+
logger.error(
538+
'Failed to drop EDV doc version 0 index; perhaps already dropped; ' +
539+
'will check again later.', {error});
540+
}
541+
}
534542
return;
535543
}
536544

0 commit comments

Comments
 (0)