[DOCS-14927] Investigate changes in SERVER-54571: queryHash and planCacheKey Fields Absent in getMore Requests Created: 11/Nov/21  Updated: 13/Nov/23  Resolved: 16/Nov/21

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 5.1.0-rc0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Jason Price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-54571 queryHash and planCacheKey Fields Abs... Closed
Participants:
Days since reply: 2 years, 12 weeks, 1 day ago
Epic Link: DOCSP-14300
Story Points: 2

 Description   
Downstream Change Summary

This change adds the "queryHash" and "planCacheKey" fields to the slow query log lines for getMore commands, as well as to the profiler entries for these getMores.

Description of Linked Ticket

Hi Team,

Starting in v4.2, MongoDB introduced the queryHash and planCacheKey that respectively help identify slow queries with the same query shape and the plan cache entry associated with the query.

Said fields are present in the log from the initial batch for a "slow" query:

{
  "type": "command",
  "ns": "test.foo",
  "appName": "MongoDB Shell",
  "command": {
    "find": "foo",
    "filter": {
      "a": 1
    },
    "lsid": {
      "id": {
        "$uuid": "564cec84-a387-4fa5-9f50-97eafe97efde"
      }
    },
    "$db": "test"
  },
  "planSummary": "IXSCAN { a: 1 }",
  "cursorid": 8918754329959567000,
  "keysExamined": 101,
  "docsExamined": 101,
  "numYields": 0,
  "nreturned": 101,
  "queryHash": "4B53BE76",
  "planCacheKey": "100FCEBA",
  "reslen": 3825,
  "locks": {
    "ReplicationStateTransition": {
      "acquireCount": {
        "w": 1
      }
    },
    "Global": {
      "acquireCount": {
        "r": 1
      }
    },
    "Database": {
      "acquireCount": {
        "r": 1
      }
    },
    "Collection": {
      "acquireCount": {
        "r": 1
      }
    },
    "Mutex": {
      "acquireCount": {
        "r": 1
      }
    }
  },
  "storage": {
    "data": {
      "bytesRead": 2013,
      "timeReadingMicros": 3
    }
  },
  "protocol": "op_msg",
  "durationMillis": 1
}

But are absent from any subsequent getMore requests:

{
  "type": "command",
  "ns": "test.foo",
  "appName": "MongoDB Shell",
  "command": {
    "getMore": 8918754329959567000,
    "collection": "foo",
    "lsid": {
      "id": {
        "$uuid": "564cec84-a387-4fa5-9f50-97eafe97efde"
      }
    },
    "$db": "test"
  },
  "originatingCommand": {
    "find": "foo",
    "filter": {
      "a": 1
    },
    "lsid": {
      "id": {
        "$uuid": "564cec84-a387-4fa5-9f50-97eafe97efde"
      }
    },
    "$db": "test"
  },
  "planSummary": "IXSCAN { a: 1 }",
  "cursorid": 8918754329959567000,
  "keysExamined": 276,
  "docsExamined": 276,
  "cursorExhausted": true,
  "numYields": 0,
  "nreturned": 276,
  "reslen": 10474,
  "locks": {
    "ReplicationStateTransition": {
      "acquireCount": {
        "w": 1
      }
    },
    "Global": {
      "acquireCount": {
        "r": 1
      }
    },
    "Database": {
      "acquireCount": {
        "r": 1
      }
    },
    "Collection": {
      "acquireCount": {
        "r": 1
      }
    },
    "Mutex": {
      "acquireCount": {
        "r": 1
      }
    }
  },
  "storage": {},
  "protocol": "op_msg",
  "durationMillis": 0
}

This happens for both find and aggregate operations in both v4.2.12 and v4.4.4.

It would be nice to have these fields present in the getMore requests as not having them makes troubleshooting more difficult and/or inaccurate when using those fields as an analysis criteria, for example:

  1. We might miss the getMore requests.
  2. We might miss a query shape in its entirety if the first batch is slow and the slowness is only observed in subsequent getMore requests.

Regards
Diego



 Comments   
Comment by Githook User [ 16/Nov/21 ]

Author:

{'name': 'jason-price-mongodb', 'email': '69260375+jason-price-mongodb@users.noreply.github.com', 'username': 'jason-price-mongodb'}

Message: DOCS-14927 queryHash and planCacheKey (#6154)

Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Branch: master
https://github.com/mongodb/docs/commit/684004c08d9da1a528eec2994109c272eabb1763

Comment by Githook User [ 16/Nov/21 ]

Author:

{'name': 'jason-price-mongodb', 'email': '69260375+jason-price-mongodb@users.noreply.github.com', 'username': 'jason-price-mongodb'}

Message: DOCS-14927 queryHash and planCacheKey (#6153)

Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Branch: master
https://github.com/mongodb/docs/commit/bf91714df355a64078e5f2f434dedcd97bda317c

Comment by PM Bot [ 11/Nov/21 ]

Downstream changes updated for upstream SERVER-54571:
This change adds the "queryHash" and "planCacheKey" fields to the slow query log lines for getMore commands, as well as to the profiler entries for these getMores.

Generated at Thu Feb 08 08:11:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.