vinyl: fix index name in duplicate key error message #10023
Merged
+88
−60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code setting
ER_TUPLE_FOUND
usesindex_name_by_id()
to find the index name, but it passes an index in the dense index map to it while the function expects an index in the sparse index map. Apparently, this doesn't work as expected after an index is removed from the middle of the index map. This bug was introduced by commit fc3834c.Instead of just fixing the index passed to
index_name_by_id()
, we do a bit of refactoring. We stop passingindex_name
andspace_name
tovy_check_is_unique_*()
functions and instead get them right before raisingER_TUPLE_FOUND
. Note, to get the space name, we need to callspace_by_id()
but it should be fine because (a) the space is very likely to be cached as the last accessed one and (b) this is an error path so it isn't performance critical. We also dropindex_name_by_id()
and extract the index name from the LSM tree object.Closes #5975