Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable archiver for use rudder storage for dtaging file entries #4433

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 14 additions & 16 deletions warehouse/archive/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@
continue
}

hasUsedRudderStorage := a.usedRudderStorage(u.uploadMetdata)

// archive staging files
stagingFileIDs, err := a.getStagingFilesData(ctx, txn, u)
if err != nil {
Expand All @@ -288,20 +286,18 @@

var storedStagingFilesLocation string
if len(stagingFileIDs) > 0 {
if !hasUsedRudderStorage {
filterSQL := fmt.Sprintf(`id IN (%v)`, misc.IntArrayToString(stagingFileIDs, ","))
storedStagingFilesLocation, err = a.backupRecords(ctx, backupRecordsArgs{
tableName: warehouseutils.WarehouseStagingFilesTable,
sourceID: u.sourceID,
destID: u.destID,
tableFilterSQL: filterSQL,
uploadID: u.uploadID,
})
if err != nil {
a.log.Errorf(`[Archiver]: Error backing up staging files for upload: %d: %v`, u.uploadID, err)
_ = txn.Rollback()
continue
}
filterSQL := fmt.Sprintf(`id IN (%v)`, misc.IntArrayToString(stagingFileIDs, ","))
storedStagingFilesLocation, err = a.backupRecords(ctx, backupRecordsArgs{
tableName: warehouseutils.WarehouseStagingFilesTable,
sourceID: u.sourceID,
destID: u.destID,
tableFilterSQL: filterSQL,
uploadID: u.uploadID,
})
if err != nil {
a.log.Errorf(`[Archiver]: Error backing up staging files for upload: %d: %v`, u.uploadID, err)
_ = txn.Rollback()
continue

Check warning on line 300 in warehouse/archive/archiver.go

View check run for this annotation

Codecov / codecov/patch

warehouse/archive/archiver.go#L298-L300

Added lines #L298 - L300 were not covered by tests
}

// delete staging file records
Expand All @@ -317,6 +313,8 @@
continue
}

hasUsedRudderStorage := a.usedRudderStorage(u.uploadMetdata)

// delete load file records
if err := a.deleteLoadFileRecords(ctx, txn, stagingFileIDs, hasUsedRudderStorage); err != nil {
a.log.Errorf("[Archiver]: Error while deleting load file records for upload %d: %v", u.uploadID, err)
Expand Down