Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80297

Reduce size of LockRequest

    • Catalog and Routing
    • Fully Compatible
    • Execution EMEA Team 2023-09-18

      LockRequest is 72 bytes on x64. There are simple ways to reduce space by sizing the enums to uint8_t and by using a bitfield for the bools. Also, work should be done to remove any holes. Also, I doubt we need to support a 32-bit lock recursion count/ 16-bit or even 8-bit likely suffices. 

      (gdb) ptype /o mongo::LockRequest.
      /* offset      |    size */  type = struct mongo::LockRequest {
      /*      0      |       8 */    mongo::Locker *locker;
      /*      8      |       8 */    mongo::LockGrantNotification *notify;
      /*     16      |       1 */    bool enqueueAtFront;
      /*     17      |       1 */    bool compatibleFirst;
      /*     18      |       1 */    bool partitioned;
      /* XXX  1-byte hole      */
      /*     20      |       4 */    unsigned int recursiveCount;
      /*     24      |       8 */    mongo::LockHead *lock;
      /*     32      |       8 */    mongo::PartitionedLockHead *partitionedLock;
      /*     40      |       8 */    mongo::LockRequest *prev;
      /*     48      |       8 */    mongo::LockRequest *next;
      /*     56      |       4 */    mongo::LockRequest::Status status;
      /*     60      |       4 */    mongo::LockMode mode;
      /*     64      |       4 */    mongo::LockMode convertMode;
      /*     68      |       4 */    unsigned int unlockPending;
      
                                     /* total size (bytes):   72 */
                                   }
      

            Assignee:
            jordi.olivares-provencio@mongodb.com Jordi Olivares Provencio
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: