[SERVER-65492] Invalidate plan cache entries when the shard version epoch changes Created: 12/Apr/22  Updated: 29/Oct/23  Resolved: 08/Nov/22

Status: Closed
Project: Core Server
Component/s: Query Planning, Sharding
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: Sergi Mateo Bellido
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-65085 SBE plan cache entries can be incorre... Closed
is related to SERVER-73395 Query on temporary resharding collect... Open
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.1, v6.0
Sprint: QO 2022-05-02, QO 2022-05-16, QE 2022-05-30, QE 2022-06-27, Sharding EMEA 2022-07-25, Sharding EMEA 2022-08-08, Sharding EMEA 2022-08-22, Sharding EMEA 2022-09-05, Sharding EMEA 2022-09-19, Sharding EMEA 2022-10-03, Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31, Sharding EMEA 2022-11-14
Participants:

 Description   

In SERVER-65085, we are planning to add the shard version epoch and timestamp to the SBE plan cache key. This is necessary to make sure that an SBE plan cache entry cannot be re-used across a refineCollectionShardKey boundary.

This ticket will improve the solution from SERVER-65085 by adding logic to clean up SBE plan cache entries associated with the older epoch when the collection's epoch is incremented. We could just leave the invalid cache entries around in the cache, since the changes to the plan cache key will prevent these old cache entries from being reused. Eventually they would be deleted due to the plan cache's LRU replacement policy. As an improvement, however, we should clean up the stale cache entries more promptly in order to avoid using memory unnecessarily.

The exact implementation strategy for doing this plan cache invalidation still needs to be decided in consultation with max.hirschhorn@mongodb.com, kaloian.manassiev@mongodb.com, and tommaso.tocci@mongodb.com.



 Comments   
Comment by Githook User [ 08/Nov/22 ]

Author:

{'name': 'Sergi Mateo Bellido', 'email': 'sergi.mateo-bellido@mongodb.com', 'username': 'smateo'}

Message: SERVER-65492 Cleaning the sbe::PlanCache when it has sharded stale info
Branch: master
https://github.com/mongodb/mongo/commit/5e1d12241178f6c6520d57476552b362b5ddf237

Generated at Thu Feb 08 06:02:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.