[SERVER-15277] dbhash caching strategy evaluation Created: 16/Sep/14  Updated: 06/Dec/22  Resolved: 05/Nov/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.7.6
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Davide Italiano Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Do Votes: 0
Labels: 28qa, lamont-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-22156 dbhash does not invalidate cache for ... Closed
Assigned Teams:
Sharding
Participants:

 Description   

My understanding is that SERVER-11021 caches dbHash results for config collections, and this helps performance of config servers. There's though nothing that prevents a user to create a db called config and use that as an ordinary database (rather than a config database) and on which subsequent calls of dbhash will return the cached value.
Can't all the dbs cache dbhash results or, if the current behaviour is preserved, can some form of validation be introduced so that only config databases on config servers cache results for dbhash?

> db.runCommand("dbhash")
{
        "numCollections" : 5,
        "host" : "ip-172-31-41-197",
        "collections" : {
                "counttable" : "8d5cc27b1d7dd9bc63592d51e5adf0b7",
                "linktable" : "0cd663975a970d8e311f4a198c83df54",
                "nodetable" : "a024eba2346cf537f6563d317101dcda"
        },
        "md5" : "ef17873e9594b8deaf738f4a90614ff4",
        "timeMillis" : 0,
        "fromCache" : [
                "config.counttable",
                "config.linktable",
                "config.nodetable"
        ],
        "ok" : 1
}



 Comments   
Comment by Greg Studer [ 19/Sep/14 ]

This is an issue, though it's definitely not good practice to use "config" as a database name, even on a single node - this prevents sharding in the future.

The main challenge is that config servers are passive storage - they aren't necessarily aware that they are special. Think the solution is to turn off this caching behavior unless explicitly enabled by a field mongos can pass to the dbhash command.

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