[JAVA-4890] Multidocument transaction support in GridFS Created: 21/Feb/23 Updated: 27/Sep/23 |
|
| Status: | Backlog |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Unknown |
| Reporter: | Ashni Mehta | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | roadmap | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Quarter: | FY24Q4 | ||||||||||||||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||||||||||||||
| Description |
|
Users have asked for multidocument transaction support in GridFS. Some requests tracked here: |
| Comments |
| Comment by Jeffrey Yemin [ 07/Mar/23 ] | ||||||||||||||||
|
One easy fix for this could be to just not use the ClientSession for the index check/creation. Sending back to Needs Triage. | ||||||||||||||||
| Comment by PM Bot [ 07/Mar/23 ] | ||||||||||||||||
|
Hey ashni.mehta@mongodb.com, We need additional details to investigate the problem. If this is still an issue for you, please provide the requested information. | ||||||||||||||||
| Comment by Jeffrey Yemin [ 22/Feb/23 ] | ||||||||||||||||
|
Thanks. It does seem that listIndexes is not supported in a transaction, although createIndexes is. While it's not the prettiest, I can suggest a workaround: The driver only executes listIndexes if the "files" collection is empty. So if you add a dummy file to that collection outside of a transaction, it should work. Something like this (though of course you'll have to structure it in a way that makes sense for your application):
| ||||||||||||||||
| Comment by Greg Stewart [ 22/Feb/23 ] | ||||||||||||||||
|
@Jeffrey Yemin The docker container I am using for testing is `mongo:5.0.14` | ||||||||||||||||
| Comment by Jeffrey Yemin [ 22/Feb/23 ] | ||||||||||||||||
|
contact@gjstewart.net what version of MongoDB are you running? According to https://www.mongodb.com/docs/manual/core/transactions/#std-label-transactions-create-collections-indexes, it seems that listIndexes, etc are supported in transactions as of MongoDB 4.4. | ||||||||||||||||
| Comment by Greg Stewart [ 21/Feb/23 ] | ||||||||||||||||
|
Hey guys, thanks for the ticket! Multidocument support is really important to me in my application. Without it, it is very hard to keep some form of ACID compliance. This affects me in two ways; The implementation I want to use uses a regular collection to keep track of all files that are stored, and then the gridfs to actually store them and handle revisions. This makes it so any modification operation requires a transactional approach that spans collections and buckets. Understand this could be antipattern in a strict sense, but I wanted more contexual information stored along with a central id to manage and track a given file/ revisions. Secondly, concerning bulk operations, i.e, import/export. My application needs to support import/export of all data held. For importing all the data across many collections and Gridfs buckets, this requires a transaction to ensure if/when errors occur to not leave the database in an inconsistent state. For now, I have left file support on my app on the backburner but would like to finish implementing. |