Investigate using typedRun() for distinct command

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-121453 makes distinct command use the TypedCommand interface but does not use typedRun().

      One major blocker to using typedRun() is that we perform this BSON size check on the raw response BSON. However, if we try to use a typed Reply, we would have to come up with another method of doing this size check since the Reply object itself has no way to knowing its size.
      2 potential solutions are:
      1. Serialize the typed Reply object and measure its size. This will result in us duplicating the work of serializing since the caller of typedRun() will have to do the serialization anyway. It will also require careful benchmarking since I suspect that larger Reply objects (due to larger set of values returned by distinct) will have a non-negligible serialization cost.
      2. Instead of checking the size of the Reply directly, we can add some constant to the already calculated listApproxBytes (see above in this function), to account for the bytes of characters that may exist in the full BSON, e.g. clusterTime, document braces "

      {" "}

      "etc, and then perform the size check.

      If we are able to make distinct command typed and modify the IDL appropriately, then we should also make cluster distinct use typedRun()

            Assignee:
            Unassigned
            Reporter:
            Naafiyan Ahmed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: