---
title: "Index update can be wrongly applied on batch writes"
url: "https://docs.yugabyte.com/stable/releases/techadvisories/ta-20648/"
---

# Index update can be wrongly applied on batch writes

During batch write operations, index updates may be incorrectly applied, potentially leading to index corruption.

23 Jan 2024

| Product                   | Affected Versions                                                                                                        | Related Issues                                                 | Fixed In                                                                                                                                                                                                               |
|---------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [YSQL](/stable/api/ysql/) | [v2.20.x](/stable/releases/ybdb-releases/end-of-life/v2.20), [v2.19.x](/stable/releases/ybdb-releases/end-of-life/v2.19) | [#20648](https://github.com/yugabyte/yugabyte-db/issues/20648) | [v2.20.1.3](/stable/releases/ybdb-releases/end-of-life/v2.20#v2.20.1.3), [v2.20.2+](/stable/releases/ybdb-releases/end-of-life/v2.20#v2.20.2.0), [v2.21.0](/stable/releases/ybdb-releases/end-of-life/v2.21#v2.21.0.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](/stable/releases/ybdb-releases/end-of-life/v2.20) series release prior to [v2.20.1.3](/stable/releases/ybdb-releases/end-of-life/v2.20#v2.20.1.3), it is recommended that you upgrade to YugabyteDB [v2.20.1.3](/stable/releases/ybdb-releases/end-of-life/v2.20#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.
