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

Consider __wt_buf_reset to clear WT_ITEM data

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Not Applicable
    • Labels:
    • Storage Engines
    • StorEng - Defined Pipeline

      sue.loverso@mongodb.com brought this up during a review of WT-12811. We have various code that clears the data/size of a WT_ITEM, here's an example from that review:

              cursor->key.data = NULL;
              cursor->key.size = 0;
      

      It would probably be good to encapsulate all such code patterns, maybe in a function called __wt_buf_reset. Among the usual encapsulation benefits, it might discourage clearing a WT_ITEM completely (w/ memset or WT_CLEAR). That is almost always incorrect, as it could leak memory held by the WT_ITEM->mem.

            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:
            4 Start watching this issue

              Created:
              Updated: