[SERVER-12358] Add query plan history and logging Created: 14/Jan/14  Updated: 10/Dec/14  Resolved: 24/Jan/14

Status: Closed
Project: Core Server
Component/s: Admin, Diagnostics, Logging, Querying
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Duplicate Votes: 0
Labels: query_triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-8692 Add logging to indicate when cached q... Closed
Related
related to SERVER-8871 Support admin hints per query pattern Closed
related to SERVER-5470 View memorized query optimized plans Closed
related to SERVER-666 query optimizer introspection Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Things exit the cache for:
1. safety reasons (index add/drop)
2. no more space in cache
3. performance degrades
4. writes (changes data distribution)
5. explicit commands to mutate cache

Let's log when this happens w/level...1.

The query optimizer currently generates a query plan which is cached and re-used based on the normalized "shape" of the query predicate and sort criteria.

It would be useful to be able to identify plans by id (e.g., hash value) for tracking, hinting and logging.

  1. Tracking
    Store the history when the query plan is changed and what it was changed to in the db's system.plans collection.
  2. Diagnostics
    Log every time the plan changes for a given query, e.g., <query_id>: changed <old_plan_id> to <new_plan_id>


 Comments   
Comment by Githook User [ 24/Jan/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-12358 log feedback failures with QLOG()
Branch: master
https://github.com/mongodb/mongo/commit/56e6f5ac4bbff54b95ce956823e4b80fc6769bc9

Comment by Githook User [ 24/Jan/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-12358 added plan cache logging
Branch: master
https://github.com/mongodb/mongo/commit/1d2662097d056641a544cfc84e91ef2f1b86623e

Comment by Eric Milkie [ 21/Jan/14 ]

Currently the server is very noisy when I run it with a simple insert and remove:

2014-01-21T10:31:21.049-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:21.368-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:21.684-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:22.021-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:22.340-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:22.660-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:22.997-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:23.315-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:23.624-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:23.952-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:24.274-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:24.589-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache
2014-01-21T10:31:24.909-0500 [conn42] warning: Failed to update cache with feedback: BadValue no such key in cache

This message should probably not be a warning.

Generated at Thu Feb 08 03:28:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.