Nikita Pettik
authored
vy_task_write_run() is executed in auxiliary thread (dump or compaction). Write iterator is created and used inside this function. Meanwhile, creating/destroying tuples in these threads does not change reference counter of corresponding tuple formats (see vy_tuple_delete() and vy_stmt_alloc()). Without cleaning up write iterator right in write_iterator_start() after fail, this procedure takes place in vy_task_compaction_abort() or vy_task_dump_abort(). These *_abort() functions in turn are executed in the main thread. Taking this into consideration, tuple might be allocated in aux. thread and deleted in the main thread. As a result, format reference counter might decrease, whereas it shouldn't change (otherwise tuple format will be destroyed before all tuples of this format are gone). Fortunately, clean-up of write iterator in another thread was found only on 1.10 branch, master branch already contains fix but lacks test (2f17c929). So let's introduce test with following scenario: 1. run compaction process; 2. add one or more slice sources in vy_write_iterator_start(): corresponding slice_stream structures obtain newly created tuples in vy_slice_stream_next(); 3. the next call of vy_write_iterator_add_src() fails due to OOM, invalid run file or whatever; 4. if write_iterator_start() didn't provide clean-up of sources, it would take place in vy_task_dump_abort() which would be executed in the main thread; 5. now format reference counter would be less than it was before compaction. Closes #4864
Name | Last commit | Last update |
---|