
|          Product           |  Affected Versions  |  Related Issues   | Fixed In |
| :------------------------- | :------------------ | :---------------- | :------- |
| {{<product "ysql">}}       | {{<release "2.20.x">}} | {{<issue 21218>}} | {{<release "2.20.2, 2.18, 2.21">}}  |

## Description

Colocated table and Packed Rows: DML and DDL workloads fail with an error related to missing schema packing. In v2.20.0+ builds, the packed row feature is enabled by default for YSQL API. However, this only applies to new clusters; existing clusters upgraded from older releases such as v2.14, v2.6, or v2.18 won't be impacted. If you create colocated tables and perform many DDLs to them after a PITR, there is a chance that the workload could result in errors mentioned in {{<issue 21218>}}. This may result in a yb-tserver crash loop on the impacted node.
Note that this issue could also affect v2.18 builds, if you have explicitly enabled YSQL packed row feature for colocated tables, using the flag, `ysql_enable_packed_row_for_colocated_table`.

## Mitigation

If you are using a build without the fix, you can disable packed row for YSQL for colocated table by setting the flag `ysql_enable_packed_row_for_colocated_table` to false. Note that if you encounter the issue, disabling the flag won't help anymore. The flag needs to be disabled on the workloads from the beginning.

## Details

During the garbage collection of schema packing in DocDB, the `TableInfoPtr` in `KvStoreInfo::tables` is updated to a new value but the pointer in `KvStoreInfo::colocation_to_table` is left unchanged in certain scenarios after a PITR. This can lead to corruption of the tablet metadata, that causes workloads to fail, missing schema packing info at the DocDB layer.
