[SERVER-52544] Update IDL definition for listDatabases command Created: 02/Nov/20  Updated: 29/Oct/23  Resolved: 25/Nov/20

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

Type: Task Priority: Major - P3
Reporter: Samyukta Lanka Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-8323 Inconsistent return values from listD... Closed
is depended on by SERVER-52554 Convert listDatabases command impleme... Closed
is depended on by SERVER-53149 Specify input/output to getMore comma... Closed
Documented
is documented by DOCS-14020 Investigate changes in SERVER-52544: ... Closed
Backwards Compatibility: Minor Change
Participants:

 Description   

The listDatabases command already has IDL specifying its input. We should modify this to include updates we've made to IDL Command Syntax, like adding apiVersion and defining the replyType.



 Comments   
Comment by A. Jesse Jiryu Davis [ 25/Nov/20 ]

After this change, listDatabases rejects unrecognized arguments.

The listDatabases reply from mongod and mongos were inconsistent. I'm choosing to make mongod's output more like mongos's. The listDatabases reply from mongod now includes "totalSizeMb", and the numbers returned by mongod and mongos are now all int64 (resolving the old SERVER-8323).

Here's an example mongos reply, it shows the size of the database named "db" on two shards:

{
  "databases": [
    {
      "name": "db",
      "sizeOnDisk": 81920,
      "empty": false,
      "shards": {
        "test-rs0": 40960,
        "test-rs1": 40960
      }
    }
  ],
  "totalSize": 1323008,
  "totalSizeMb": 1,
  "ok": 1
}

Here's how types will change after this patch:

+-------------+-----------------+-----------------+
|             |      mongod     |       mongos    |
+-------------------------------------------------+
| sizeOnDisk  | double -> int64 | int64           |
|             |                 |                 |
| shards      | absent          | int32* -> int64 |
|             |                 |                 |
| totalSize   | double -> int64 | int32* -> int64 |
|             |                 |                 |
| totalSizeMb | absent -> int64 | int32* -> int64 |
|             |                 |                 |
+-------------+-----------------+-----------------+

The type of each number with "*" was chosen according to its magnitude; it was usually an int32 but could be double or int64 (see BSONObjBuilder::appendNumber). Now, totalSize and totalSizeMb are always int64, as are the sizes per shard.

Comment by Githook User [ 25/Nov/20 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: SERVER-52544 Update IDL for listDatabases
Branch: master
https://github.com/mongodb/mongo/commit/403c9577ea2a447c2660715af6540e66da8fc4c8

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