[JAVA-2765] [GridFs] - Provide ability to append binary data in existing file Created: 01/Feb/18 Updated: 04/Mar/19 Resolved: 04/Mar/19 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Gustavo de Geus | Assignee: | Ross Lawley |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
The idea to be able to append new binary data into existing files is interesting for use cases such as a resumable file upload where the application server receives the data in chunks and has to append it into an existing fs.file. The C# Driver exposes this functionality if you use MongoGridFSStream Class. |
| Comments |
| Comment by Ross Lawley [ 04/Mar/19 ] |
|
After a review by fellow driver authors, it has been decided not to add this to the GridFS API due to the potential for conflicting reads, during the write / append process. You could use the existing API to create a new file that is based on the original file and the extra data. |
| Comment by Scott L'Hommedieu (Inactive) [ 14/Jan/19 ] |
|
This should be dealt with at a driver spec level to ensure gridfs files are handled similarly across all drivers. See: SPEC-1202 |
| Comment by Jeffrey Yemin [ 09/Jan/19 ] |
|
scott.lhommedieu there are concurrency issues even with append-only modifications. How would we handle two clients attempting to append to the same file concurrently? I think we could do this with transactions once they support >16MB updates and sharded clusters. |
| Comment by Scott L'Hommedieu (Inactive) [ 09/Jan/19 ] |
|
I don't see any reason why we can't support this. Append only is viable/feasible. We wouldn't extend this to insert in the middle of an existing file which would be a complex operation with more sharp edges (finding chunks, moving chunks, concurrency from clients) than we could manage. |