[DRIVERS-559] GridFS with multi-document transaction support does not work Created: 09/Aug/18 Updated: 21/Feb/23 |
|
| Status: | Backlog |
| Project: | Drivers |
| Component/s: | GridFS |
| Fix Version/s: | None |
| Type: | Spec Change | Priority: | Major - P3 |
| Reporter: | Wan Bachtiar | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | bernie+, gridfsv2 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
In MongoDB 4.0, multi document transactions does not work with GridFS because:
GridFS with transaction would be a very special case (I don't know if there's any yet). |
| Comments |
| Comment by Shane Harvey [ 13/May/20 ] | |||||||||||||||||||||||||||||||||||||||||
|
Since MongoDB 4.4 allows createIndexes in multi-document transactions, transactions are now compatible with GridFS (with PyMongo 3.10.1):
On MongoDB 4.2, the server returns this error:
However I still think it makes sense to remove support for this feature until we have a cross drivers spec for transactions+sessions in GridFS. I've opened | |||||||||||||||||||||||||||||||||||||||||
| Comment by Bernie Hackett [ 13/May/20 ] | |||||||||||||||||||||||||||||||||||||||||
|
Until we have a real story for GridFS and transactions we should prohibit drivers from making up a story, and avoid bugs like this. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Bernie Hackett [ 13/May/20 ] | |||||||||||||||||||||||||||||||||||||||||
|
shane.harvey, is there a PyMongo bug here? | |||||||||||||||||||||||||||||||||||||||||
| Comment by Esha Bhargava [ 13/Apr/20 ] | |||||||||||||||||||||||||||||||||||||||||
|
We should eventually add a test for this but we expect it to work in 4.4. | |||||||||||||||||||||||||||||||||||||||||
| Comment by Scott L'Hommedieu (Inactive) [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||
|
I've opened docs ticket DOCSP-6255 to get this clarified in docs until we prioritize work on new features for GridFS. | |||||||||||||||||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 10/Aug/18 ] | |||||||||||||||||||||||||||||||||||||||||
|
I'd vote for documenting in drivers: "GridFSBucket does not support transactions." | |||||||||||||||||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 10/Aug/18 ] | |||||||||||||||||||||||||||||||||||||||||
|
OK, I understand you better. PyMongo (at least) has implemented sessions support for GridFSBucket, although it wasn't required to. Since PyMongo's GridFSBucket has sessions support, it got transactions support for GridFSBucket automatically, but transactions don't work with GridFSBucket. (You can't create an index in a transaction, nor do large or slow operations.) The errors this causes are unintuitive. There's some distractions in the original Stack Overflow question: the user starts by creating a transaction in a session but they can't pass the session to GridFS, because GridFS is deprecated and doesn't have a session parameter. So they spend a minute uploading a file not in the transaction, and then they commit the transaction but it timed out while they were uploading. The user doesn't know about the new GridFSBucket API, which does support sessions and therefore sort of supports transactions. Anyway, next the user tries passing a session directly to a low-level API called GridIn, so they do manage to do the file upload in a transaction, but that doesn't work because GridIn tries to create indexes in the transaction. |