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.)
- is related to
-
SERVER-43883 Enable WiredTiger cursor copy debug mode in asan builds
- Closed