Allow opting out of automatic index creation on upload with GridFS

XMLWordPrintableJSON

    • Needed

      Summary

      Add a GridFS bucket option to let drivers skip the automatic index-existence bootstrap (emptiness check + listIndexes/createIndexes) that currently runs before the first write on a bucket. Today this bootstrap is mandatory and unconditional; we want an opt-in (default off, no behavior change) that lets applications skip it when they've already ensured the indexes exists. This is important in sharded setups, where one shard being down would disallow uploads in other healthy shards.  

      Motivation

      Who is the affected end user?

      Application developers using GridFS uploads against sharded deployments, and/or accounts with write-only (no read) privileges on the GridFS collections.

      How does this affect the end user?

      There are two concerns:

      1. Sharded availability. The emptiness-check findOne against fs.files has no shard key, so it's broadcast to every shard. If any shard is down, the check fails and the entire upload fails, even though the actual chunk write (targeted by files_id) would only hit a healthy shard. The linked ticket reported a real-world case: users in one data center were unable to upload because a shard in a different, unrelated data center was offline.
      2. Write-only users. The spec's existing read-only accommodation only covers the index-creation step, not the emptiness-check findOne itself, which still requires read privileges. A write-only user (no read access) can't upload at all today.

      Users are blocked in both cases. 

      How likely is it that this problem or use case will occur?

      Not very probable. Sharded-availability is the more plausible of the two (any sharded GridFS deployment with a transient shard outage hits it). Write-only auth is expected to be rare as there are no built-in MongoDB role grants write-only access, so it would require a custom role.

      If the problem does occur, what are the consequences and how severe are they?

      It is not possible to do GridFS upload if one shard is down. 

      Is this issue urgent?

      No

      Is this ticket required by a downstream team?

      No

      Is this ticket only for tests?

      No

      Acceptance Criteria

      What specific requirements must be met to consider the design phase complete?

            Assignee:
            Unassigned
            Reporter:
            Ferdinando Papale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: