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

Explore no-copy inserts and updates

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Not Applicable
    • Labels:
      None
    • Storage Engines

      When inserting, the cursor interface collects keys/values via the set_key or set_value API calls.  The data goes into the WT_CURSOR.key or value buffers, which may require malloc (addressed in WT-12811).  But if the key_format or value_format is "u", or the cursor was opened in "raw" mode, we really don't need to do a copy - provided the caller does not overwrite their own buffer between the set_key/value and the use of the data via a insert/update/search.

      Note - the above conditions, format="u" and buffer remains valid, should be satisfied by MongoDB.  So I think we can often/always avoid a copy to the intermediate buffer in MongoDB.  WT_ITEM already has the capability to point outside its own allocated memory, but would we be violating any assumptions.  So potentially this is a pretty small change.

      We'll need to read/modify the doc carefully.  While we haven't made a promise (that I can see) that we're making a copy, in cases where the format has a non-"u" schema (e.g. "iSS"), the arguments to set_value are clearly "by value".  So to be safe maybe we need/want to put the new behavior on a cursor or connection flag?

      (Component: cursors)

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            donald.anderson@mongodb.com Donald Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: