Describe the bug
When uploading a 1.5GB large file using mongofiles with a persistent cursor (parameter useFileBasePersistedCursors set to true), and subsequently downloading the same file with the mongofiles tool, an error "chunk index does not match expected index" occurs. Preliminary analysis suggests that the BsonStoreDestReceiveCore function first triggers the sizeLimitReached condition, resulting in an incorrect initial batch of data being returned. This causes the mongofiles driver to report the error and pause the download.
Environment
- Operating system and version
- PostgreSQL version
- Architecture
Reproduction Steps
Steps to reproduce the behavior:
A code snipped or accessible repository that can reproduce the issue.
Expected behavior
A clear and concise description of what you expected to happen.
Actual behavior
Additional context
Add any other context about the problem here.
OS: centos 9
pg: 17