Index update can be wrongly applied on batch writes

23 Jan 2024
Product Affected Versions Related Issues Fixed In
YSQL v2.20.x, v2.19.x #20648 v2.20.1.3, v2.20.2+, v2.21.0

Description

The impacted releases contain an issue where an index update can be wrongly applied, leading to index corruption in the following rare cases:

  • Update to a table with non-unique indexes and self-referential triggers where both the index updates, and the trigger application affect the same rows.
  • Multi-row update to a table with a non-unique partial index.

Mitigation

If you're using a v2.20 series release prior to v2.20.1.3, it is recommended that you upgrade to YugabyteDB v2.20.1.3 or later. The fix ensures new writes to get executed correctly. But it will not repair existing inconsistent data. To fix inconsistent indexes, the indexes need to be recreated. It is advisable to create a new index, and then drop the older one.