Skip to main content
Publication date: October 24, 2022

Description

In CockroachDB to and to , a RESTORE of an incremental backup may include rows that should not be restored, in a narrow set of circumstances relating to an ongoing IMPORT INTO job. This has been fixed in CockroachDB patch versions v22.1.9 and v21.2.17, available in . This issue primarily affects incremental backups taken after an IMPORT INTO operation is reverted. For this issue to occur, the following series of conditions need to occur:
  1. First, a table must be backed up, typically as part of a full-cluster backup, while it is offline and being written to by an ongoing IMPORT INTO job. Rows which are being written to the table by the in-progress IMPORT INTO job are included in this backup.
  2. Next, that IMPORT INTO job must fail or be canceled. This failure or cancellation triggers the roll-back process, which reverts rows which it had written, and then brings the table back online.
  3. After the IMPORT INTO rollback completes and the table is back online, an incremental backup must be taken of the table. This incremental backup is appended to the original backup that was taken while the table was offline.
  4. When this incremental backup is restored using an affected CockroachDB version, rows which were initially written by the IMPORT and backed up, but then later reverted when the IMPORT INTO was canceled before the incremental backup, will incorrectly appear in the restored table.
If a backup chain starts from a full backup subsequent to the IMPORT INTO job cancellation, it is unaffected. The technical details can be found in the following GitHub issues:
  • #88042
  • #88043

Statement

The fix has been applied to the maintenance release of CockroachDB and CockroachDB .

Mitigation

Users of CockroachDB to are encouraged to upgrade to or a later version. Users of CockroachDB to are encouraged to upgrade to or a later version. If a RESTORE must be run using prior versions, Cockroach Labs recommends that where possible, you restore only to full backups. If you must restore to an incremental backup taken on an affected version, restore only tables on which IMPORT INTO did not run or succeeded. The best mitigation, however, is to upgrade to v22.1.9 or v21.2.17 as soon as possible.

Impact

A RESTORE of an incremental backup may include rows that should not be restored, in a narrow set of circumstances relating to an ongoing IMPORT INTO job. Versions affected include v22.1.0 to v22.1.8 and v21.2.0 to v21.2.16. Please reach out to the support team if more information or assistance is needed.