Empty tag set rejects servers with no tags

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Rust Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      An empty tag set in a read preference appears to reject servers with no tag sets.

      Reproducing

      Start a replica set with a secondary containing no tags:

      mlaunch init \
          --replicaset --nodes=2 --name=repl0 --setParameter enableTestCommands=1 \
          --binarypath $HOME/bin/mongodl/archive/8.0.17/mongodb-macos-aarch64-enterprise--8.0.17/bin  \
          --dir .menv
      

      Run this repro. It attempts to select a server with with SecondaryPreferred and an empty tag set:

      % cargo run --quiet
      ERROR: expected to select SECONDARY, but selected PRIMARY
      

      Testing PyMongo selects the secondary:

      % python test-pymongo.py 
      OK: selected SECONDARY
      

      I expect an empty tagset is intended to match a server without tags. Quoting Server Selection spec:

      The default tag_sets is a list with an empty tag set: [{}].

      Background
      Using a debugger, the secondary appears to get rejected in matches_tag_set:

      let server_tags = match reply.command_response.tags {
          Some(ref tags) => tags,
          None => return false,
      };
      

      I expect this should be changed to:

      let server_tags = match reply.command_response.tags {
          Some(ref tags) => tags,
          None => return tag_set.is_empty(),
      };
      

            Assignee:
            Kevin Albertson
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: