Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-317

listCollections is repeatedly requested when no JSON schema is configured

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.2
    • Affects Version/s: None
    • Component/s: C library

      Automatic encryption unnecessarily requests listCollections on a collection with no JSON schema configured.

      libmongocrypt checks if a collection has a JSON schema configured by doing the following:
      1. Checks if there is an entry in the locally configured schema map.
      2. Checks if there is a cached schema obtained from a previous listCollections reply.

      libmongocrypt will cache the response for a collection that does not have a JSON schema configured.
      https://github.com/mongodb/libmongocrypt/blob/91d2a11bea3569d46001a3a3ef57161bd3706eab/src/mongocrypt-ctx-encrypt.c#L104

      However, the check for a cached response does not account for collections that have no schema configured. The absense of a configured schema should still be cached.
      https://github.com/mongodb/libmongocrypt/blob/91d2a11bea3569d46001a3a3ef57161bd3706eab/src/mongocrypt-ctx-encrypt.c#L895

      This results in drivers repeatedly requesting listCollections unnecessarily.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: