Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11936

Investigate to remove the recursive cursor calls inside the history store cursor

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • StorEng - Refinement Pipeline
    • None

      Currently, the history store cursor is defined as:

      struct __wt_cursor_hs {
          WT_CURSOR iface;
      
          WT_CURSOR *file_cursor; /* Queries of regular history store data */
          WT_TIME_WINDOW time_window;
          uint32_t btree_id;
          WT_ITEM *datastore_key;
      
      /* AUTOMATIC FLAG VALUE GENERATION START 0 */
      #define WT_HS_CUR_BTREE_ID_SET 0x1u
      #define WT_HS_CUR_COUNTER_SET 0x2u
      #define WT_HS_CUR_KEY_SET 0x4u
      #define WT_HS_CUR_TS_SET 0x8u
          /* AUTOMATIC FLAG VALUE GENERATION STOP 8 */
          uint8_t flags;
      };
      

      Therefore, each history store cursor call has to call the underlying file cursor which deepens our call stack and we are hit with the cursor setup overhead inside the file cursor.

      If we can change the history store cursor to the following definition, we can potentially remove this overhead:

      struct __wt_cursor_hs {
          WT_CURSOR_BTREE cbt;  <-------------------------------------- use a btree cursor directly instead of a file cursor
          WT_TIME_WINDOW time_window;
          uint32_t btree_id;
          WT_ITEM *datastore_key;
      
      /* AUTOMATIC FLAG VALUE GENERATION START 0 */
      #define WT_HS_CUR_BTREE_ID_SET 0x1u
      #define WT_HS_CUR_COUNTER_SET 0x2u
      #define WT_HS_CUR_KEY_SET 0x4u
      #define WT_HS_CUR_TS_SET 0x8u
          /* AUTOMATIC FLAG VALUE GENERATION STOP 8 */
          uint8_t flags;
      };
      

      We can reference the bulk cursor for guide of how to implement the history store cursor in this way.

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            chenhao.qu@mongodb.com Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: