Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-158

Bucket::delete() should not delete orphaned chunks before files document

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.0-alpha1, 1.1.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Currently, Bucket::delete() finds the file document, deletes orphan chunks, conditionally throws a file-not-found exception, and then attempts to delete the files document. Orphan chunk deletion should only happen after an attempted files document deletion, per the spec:

      To minimize the window of vulnerability of reading a stored file that is the process of being deleted, drivers MUST first delete the files collection document for a stored file, then delete its associated chunks.

      If there is no such file listed in the files collection, drivers MUST raise an error. Drivers MAY attempt to delete any orphaned chunks with files_id equal to id before raising the error.

            william.banfield William Banfield
            jmikola@mongodb.com Jeremy Mikola
            0 Vote for this issue
            2 Start watching this issue