Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-266

Remove support for updating an existing GridFS file

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: Undecided
    • Component/s: GridFS
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • # Replies:
      5
    • Last comment by Customer:
      false

      Description

      No other driver supports updating an existing GridFS file. The reason given is that this is a very dangerous operation, because while the update is in progress the GridFS file is in an intermediate state and if any other process or thread tries to read the GridFS file during that time the results will be unpredictable.

      This involves removing or changing the following methods:

      MongoGridFS class:
      remove AppendText method
      rename Create methods to CreateNew (because Create FileMode is no longer supported)
      rename CreateText methods to CreateTextNew (because Create FileMode is no longer supported)
      Open methods won't support FileModes: Create, OpenOrCreate, Truncate or Append (only Open or CreateNew will be supported)

      MongoGridFSFileInfo class:
      remove AppendText method
      rename Create methods to CreateNew (because Create FileMode is no longer supported)
      rename CreateText methods to CreateTextNew (because Create FileMode is no longer supported)
      Open methods won't support FileModes: Create, OpenOrCreate, Truncate or Append (only Open or CreateNew will be supported)

      This change is scheduled for version 1.3 to provide sufficient time for comments.

        Activity

        Hide
        rstam Robert Stam added a comment -

        This change is backward breaking if you were using this capability.

        Show
        rstam Robert Stam added a comment - This change is backward breaking if you were using this capability.
        Hide
        emmanuelbuah emmanuel buah added a comment -

        Rather than removing the feature, isn't it possible to provide a blocking feature when a file is in read state. Appending to a file is a needed operation, especially saving chucked files where we need to append the chuncks for the files. I know other drivers don't support it but a blocking feature might be a better solution. Obviously, you guys have a better understanding of its risks. Thanks for all your hard work.

        Show
        emmanuelbuah emmanuel buah added a comment - Rather than removing the feature, isn't it possible to provide a blocking feature when a file is in read state. Appending to a file is a needed operation, especially saving chucked files where we need to append the chuncks for the files. I know other drivers don't support it but a blocking feature might be a better solution. Obviously, you guys have a better understanding of its risks. Thanks for all your hard work.
        Hide
        rstam Robert Stam added a comment -

        Thanks for your feedback. We definitely need to know if people would be affected by removing this feature. Your suggestion that perhaps we could provide a safe way to use this feature instead of just removing it is very helpful. Looking forward to more comments from other users. Thanks again.

        Show
        rstam Robert Stam added a comment - Thanks for your feedback. We definitely need to know if people would be affected by removing this feature. Your suggestion that perhaps we could provide a safe way to use this feature instead of just removing it is very helpful. Looking forward to more comments from other users. Thanks again.
        Hide
        jonathan.gaillard@dominionenterprises.com Jonathan Gaillard added a comment -

        The in place updates have given us tremendous performance boost over insertion + deletion and I would much prefer the feature to stay in some safe form.

        Show
        jonathan.gaillard@dominionenterprises.com Jonathan Gaillard added a comment - The in place updates have given us tremendous performance boost over insertion + deletion and I would much prefer the feature to stay in some safe form.
        Hide
        rstam Robert Stam added a comment -

        This feature is only dangerous if multiple processes/threads attempt to use the same GridFS file simultaneously (either multiple updaters, or other readers while the update is in progress). To use this feature safely requires application level locking to ensure that this doesn't happen.

        An additional danger is that if the client crashes or loses network connectivity before it is done updating the GridFS file (and closing the stream) the GridFS file is left in an inconsistent state.

        I don't know what the final decision on removing this feature will be... we've delayed action on this for such a long time because the right course of action does not seem immediately obvious.

        Show
        rstam Robert Stam added a comment - This feature is only dangerous if multiple processes/threads attempt to use the same GridFS file simultaneously (either multiple updaters, or other readers while the update is in progress). To use this feature safely requires application level locking to ensure that this doesn't happen. An additional danger is that if the client crashes or loses network connectivity before it is done updating the GridFS file (and closing the stream) the GridFS file is left in an inconsistent state. I don't know what the final decision on removing this feature will be... we've delayed action on this for such a long time because the right course of action does not seem immediately obvious.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since reply:
              51 weeks, 3 days ago
              Date of 1st Reply: