Skip to content

Commit

Permalink
materialize-redshift: fix logging of Store bindings with no data
Browse files Browse the repository at this point in the history
We were always calling `FinishedResourceCommit` for bindings even if they had no
data, which was resulting in bogus log lines. This fixes the logic to not invoke
the logging mechanisms for bindings with no data.
  • Loading branch information
williamhbaker committed Oct 8, 2024
1 parent 420733a commit 02692b5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions materialize-redshift/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,10 @@ func (d *transactor) commit(ctx context.Context, varcharColumnUpdates map[string
}

for _, b := range d.bindings {
if b.hasDeletes || b.hasStores {
d.be.StartedResourceCommit(b.target.Path)
if !b.hasDeletes && !b.hasStores {
continue
}
d.be.StartedResourceCommit(b.target.Path)

if b.hasDeletes {
// Create the temporary table for staging values to delete from the target table.
Expand All @@ -832,11 +833,8 @@ func (d *transactor) commit(ctx context.Context, varcharColumnUpdates map[string
}

if !b.hasStores {
d.be.FinishedResourceCommit(b.target.Path)
continue
}

if b.mustMerge {
// Pass.
} else if b.mustMerge {
// Create the temporary table for staging values to merge into the target table.
// Redshift actually supports transactional DDL for creating tables, so this can be
// executed within the transaction.
Expand All @@ -855,6 +853,7 @@ func (d *transactor) commit(ctx context.Context, varcharColumnUpdates map[string
return handleCopyIntoErr(ctx, txn, d.cfg.Bucket, b.storeFile.prefix, b.target.Identifier, err)
}
}

d.be.FinishedResourceCommit(b.target.Path)
}

Expand Down

0 comments on commit 02692b5

Please sign in to comment.