Fix concurrent append to interval with only unused segments#18216
Fix concurrent append to interval with only unused segments#18216kfaraz merged 1 commit intoapache:masterfrom
Conversation
|
This code change will append the new segment to the old set of segments. If that old set of segments had a non-zero core partition numbers, then the appended segment will carry the same set of core partitions (non-zero) and will publish the new appended segment with the extra appended partition num. This new segment will never actually be used in queries because the core partitions will never be fully loaded by the system as it is not a complete partition of data (the semantics of the system are that the core partitions must all exist for the segments in that time range to be considered complete, extra partitions can exist, but do not have to). This means that even in the case where this showed up (a segment was dropped and then new data came in), the newly created segment won't actually be queried. The correct fix for this is to generate a net-new version that is "better" than the previous version, adding more partitions to the unused segments is weird. IIRC, we used the static 1970 version just as a short-circuit because we weren't sure what the best version to use was in the case where nothing exists yet. At this point, we now understand why it's important to use a better version and the version of the lock should be "better" than the unused segments. Please revert this change and adjust to use a better version. |
This is a better approach to the fix in #18216 Changes: - When allocating the first segment in an interval which already contains an unused segment, use a fresh version rather than reusing the old version (now unused)
This is a better approach to the fix in apache#18216 Changes: - When allocating the first segment in an interval which already contains an unused segment, use a fresh version rather than reusing the old version (now unused)
This is a better approach to the fix in #18216 Changes: - When allocating the first segment in an interval which already contains an unused segment, use a fresh version rather than reusing the old version (now unused) Co-authored-by: Kashif Faraz <kashif.faraz@gmail.com>
Bug
Concurrent append uses lock of type APPEND which always uses a lock version of epoch
1970-01-01.This can cause data loss in a flow as follows:
Fix
In segment allocation, do not reuse an old segment ID, used or unused.
This fix was already done for some cases back in #16380 .
An embedded test for this has been included in #18207 EmbeddedConcurrentAppendReplaceTest
This PR has: