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

Add cursor copy debug mode

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.0, 4.3.3, 4.2.4
    • Affects Version/s: None
    • Component/s: None
    • None
    • 5
    • Storage Engines 2019-11-18, Storage Engines 2019-12-02, Storage Engines 2019-12-16, Storage Engines 2019-12-30, Storage Engines 2020-01-13, Storage Engines 2020-01-27

      There have been a class of problems where MongoDB is using the addresses for data cursors keys and values after those cursors have repositioned or reset. Those stale addresses are often still "valid" unless eviction or some other event renders them invalid.

      MongoDB would like a setting where WiredTiger will malloc a copy of the data it is returning on every positioning cursor call. When the cursor changes its position, any previous copy would be freed and a new malloc call would occur for the next data. Doing this would allow sanitizers to detect this incorrect usage and aid MongoDB in finding these issues. (I.e. we would not use realloc because that tries to use the same space nor try to use the same memory ourselves if it fits, etc. We want a free/malloc.)

      This would only need to apply to the value portion.

      My suggested API would be to add debug_mode=(cursor_copy=true)). This setting would only apply to data/table cursors, and not, for example, to statistics, metadata or backup cursors.

      (A secondary possibility in this mode could be a memcmp prior to the free to verify that the user did not alter any WiredTiger content that it wasn't supposed to.)

            donald.anderson@mongodb.com Donald Anderson
            sue.loverso@mongodb.com Susan LoVerso
            0 Vote for this issue
            6 Start watching this issue