-
Type:
Technical Debt
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Not Applicable
-
Storage Engines
-
StorEng - Defined Pipeline
-
None
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.