-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Internal Code
-
None
-
Storage Execution
The DBDirectClient class is an implementation of DBClientBase that simply calls the server's message handling code. It provides a unified API (the DBClientBase API) for performing "sub-operations", and is often used as a simple way for a command implementation to perform some subtask.
Use of DBDirectClient is generally considered harmful for a number of reasons, including that it:
- Subverts the API of the subsystem being called into, and introduces a large number of dependencies for the calling subsystem
- Introduces performance overhead through unnecessary message creation and message parsing
- Prevents yielding of locks during execution of the sub-operation, when the calling operation is already holding a lock
- Is hard for new developers to understand
- Has (historically) been a reliable source of bugs
As of version ~3.1.0 of the server, the following lists all current uses of DBDirectClient in the server. They are roughly ordered in decreasing order of difficulty to remove.
- V8Scope: provides connection objects for the eval command (e.g. the connection object associated with the "db" variable)
- dbtests/: various uses for testing
- Cloner: provides implementation of "copydb" within same host
- MapReduceCommand: miscellaneous collection admin tasks (drop/count/renameCollection/splitVector), reading documents for reduce post-processing
- DocumentSourceOut: agg $out miscellaneous collection admin tasks (create/listIndexes/createIndexes/renameCollection), inserting documents into $out collection
- AuthzManagerExternalState: CRUD operations (with write concern) on "system.users" collection
- DocumentSourceGeoNear: generates documents for $geoNear agg operator
- Trivial uses in ApplyOpsCmd, CmdFileMD5, ReplSource, initOpTimeFromOplog(), checkIfReplMissingFromCommandLine()
- is related to
-
SERVER-18545 Get dbeval working for SpiderMonkey
- Closed
-
SERVER-10228 Deprecate GodScope/God Mode
- Backlog
- related to
-
SERVER-57358 Build config.chunks indexes on background in FCV upgrade/downgrade
- Closed
-
SERVER-29495 Change DBDirectClient to access the query system interface directly
- Backlog