[SERVER-17419] Remove DBDirectClient class Created: 28/Feb/15  Updated: 06/Dec/22  Resolved: 05/Jun/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-57358 Build config.chunks indexes on backgr... Closed
related to SERVER-29495 Change DBDirectClient to access the q... Backlog
is related to SERVER-18545 Get dbeval working for SpiderMonkey Closed
is related to SERVER-10228 Deprecate GodScope/God Mode Backlog
Assigned Teams:
Storage Execution
Participants:

 Description   

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()


 Comments   
Comment by Eric Milkie [ 06/Jun/17 ]

I don't know of an existing ticket describing that work; please file one!

Comment by Spencer Brody (Inactive) [ 05/Jun/17 ]

What about changing DBDirectClient to not go through the network and command execution layers, but instead plug directly into the storage API? That would fix most of the problems with DBDirectClient. Is there a ticket for that work? I couldn't find one from a simple jira search.
milkie

Comment by Eric Milkie [ 05/Jun/17 ]

Closing this for now, as we've decided in the medium term not to pursue this.

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