When importing a collection, the alterMetadata call can return EBUSY, after which a checkpoint occurs and it is retried. In rare cases, if the second alterMetadata call returns EBUSY then the test will fail.
This may have become more common after SERVER-95921, where we checkpoint more frequently after the dry-run phase of import to ensure that the imports complete quickly.
Unfortunately there is no way to guarantee that a checkpoint is not occurring concurrently, with an alterMetadata call, since even if we use synchronization on the MongoDB side, WT can call their own checkpoints. Fortunately, the race is most prevalent in tests. As part of HELP-65363, CLOUDP-278234 was completed so that alterMetadata does not need to be called when calling ImportCollection in serverless.
From our side we could:
- Update the tests to not require the alterMetadata calls. We did this in this PR since the test more closely matches the new behaviour in serverless
- Increase the number of retries. This would likely get the tests to pass but is not a guarantee of success