PANIC when register file to a non-active workfile set. (#10793)
We used to have `Assert` to check `RegisterFileWithSet` never register file to a non-active workfile_set. But in production, there could be some corner cases that caller register file to a non-active workfile_set. It'll cause inconsistent `workfile_shared->num_active` with the real active workfile_sets numbers under some situations. For example, 1. `RegisterFileWithSet` a file to a created work_set. (current `work_set->num_files` is 1) 2. `FileClose` closes the file and causes `WorkFileDeleted` to detele the work_set since current `work_set->num_files` is 0 after detele file. Which also decrease `workfile_shared->num_active`. 3. `RegisterFileWithSet` another file to the created work_set(which actually is not active now, but we dont't prevent that, only uses `Assert` to check). 4. `FileClose` closes the file and causes `WorkFileDeleted` to detele the work_set again. The `workfile_shared->num_active` gets decreased again. Raise PANIC to expose the coner cases. Normally the caller of `RegisterFileWithSet` should ensure the correctness. But we lack of the check in the `RegisterFileWithSet`. (cherry picked from commit c23980cb)
Showing
想要评论请 注册 或 登录