Skip to content

Commit

Permalink
Merge #97217
Browse files Browse the repository at this point in the history
97217: backupccl: fix typo in restore roachtest driver around aost selection r=lidorcarmel a=msbutler

The previous select query to get the start time of the ith backup in the chain was incorrect. This patch revises that query to correctly get the end time of the ith backup in the chain. The end time is used now as it better reflects how a user would select an AOST for a restore.

Release note: None

Epic: none

Co-authored-by: Michael Butler <[email protected]>
  • Loading branch information
craig[bot] and msbutler committed Feb 15, 2023
2 parents 2447151 + 8c4463c commit 86aafba
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/cmd/roachtest/tests/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ var defaultBackupSpecs = backupSpecs{
cloud: spec.AWS,
backupProperties: "inc-count=48",
fullBackupDir: "LATEST",
incsIncluded: 12,
backupsIncluded: 12,
workload: tpceRestore{customers: 25000},
}

Expand All @@ -844,8 +844,8 @@ type backupSpecs struct {
// specifies the full backup directory in the collection to restore from.
fullBackupDir string

// specifies the number of incrementals to restore from
incsIncluded int
// specifies the number of backups in the chain to restore from
backupsIncluded int

// workload defines the backed up workload.
workload backupWorkload
Expand All @@ -865,8 +865,8 @@ func (bs backupSpecs) String(full bool) string {
}
builder.WriteString("/" + bs.cloud)

if full || bs.incsIncluded != defaultBackupSpecs.incsIncluded {
builder.WriteString("/" + fmt.Sprintf("incsIncluded=%d", bs.incsIncluded))
if full || bs.backupsIncluded != defaultBackupSpecs.backupsIncluded {
builder.WriteString("/" + fmt.Sprintf("backupsIncluded=%d", bs.backupsIncluded))
}
return builder.String()
}
Expand All @@ -883,14 +883,14 @@ func (bs backupSpecs) backupCollection() string {
bs.storagePrefix(), bs.workload.fixtureDir(), bs.version, bs.backupProperties)
}

// getAOSTCmd returns a sql cmd that will return a system time that is greater
// or equal than the start time of the incremental backups in the target backup
// chain.
// getAOSTCmd returns a sql cmd that will return a system time that is equal to the end time of
// the bs.backupsIncluded'th backup in the target backup chain.
func (bs backupSpecs) getAostCmd() string {
return fmt.Sprintf(`SELECT max(DISTINCT start_time) FROM [SHOW BACKUP FROM %s IN %s] LIMIT %d`,
return fmt.Sprintf(
`SELECT max(end_time) FROM [SELECT DISTINCT end_time FROM [SHOW BACKUP FROM %s IN %s] ORDER BY end_time LIMIT %d]`,
bs.fullBackupDir,
bs.backupCollection(),
bs.incsIncluded)
bs.backupsIncluded)
}

// makeBackupSpecs initializes the default backup specs. The caller can override
Expand Down

0 comments on commit 86aafba

Please sign in to comment.