vinyl: fix crash if snapshot is called while dump is in progress
Currently, to force dumping all in-memory trees, box.snapshot() increments scheduler->generation directly. If dump is in progress and there's a space that has more than one index and all its secondary indexes have been dumped by the time box.snapshot() is called and its primary index is being dumped, incrementing the generation will force the scheduler to start dumping secondary indexes of this space again (provided, of course, the space has fresh data). Then, creating a dump task for a secondary index will attempt to pin the primary index - see vy_task_dump_new() => vy_scheduler_pin_index() - which will crash, because the primary index is being dumped and hence can't be removed from the scheduler by vy_scheduler_pin_index(): Segmentation fault #0 0x40c3a4 in sig_fatal_cb(int)+214 #1 0x7f6ac7981890 in ? #2 0x4610bd in vy_scheduler_remove_index+46 #3 0x4610fe in vy_scheduler_pin_index+49 #4 0x45f93e in vy_task_dump_new+1478 #5 0x46137e in vy_scheduler_peek_dump+282 #6 0x461467 in vy_schedule+47 #7 0x461bf8 in vy_scheduler_f+1143 To fix that let's trigger dump (by bumping generation) only from the scheduler fiber, from vy_scheduler_peek_dump(). The checkpoint will force the scheduler to schedule dump by setting checkpoint_in_progress flag and setting checkpoint_generation. Closes #2508
Showing
Loading
Please register or sign in to comment