Skip to content

Commit

Permalink
setting timeouts to 0 for consolidate txn (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Mar 12, 2024
1 parent a517827 commit 8583d62
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions flow/connectors/postgres/qrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,11 @@ func (c *PostgresConnector) isPartitionSynced(ctx context.Context, partitionID s
}

func (c *PostgresConnector) ConsolidateQRepPartitions(ctx context.Context, config *protos.QRepConfig) error {
if config.SourcePeer.Type != protos.DBType_SNOWFLAKE ||
config.WriteMode.WriteType != protos.QRepWriteType_QREP_WRITE_MODE_OVERWRITE {
return nil
}

destinationTables := strings.Split(config.DestinationTableIdentifier, ";")

constraintsHookExists := true
Expand All @@ -621,6 +626,19 @@ func (c *PostgresConnector) ConsolidateQRepPartitions(ctx context.Context, confi
}
}()

_, err = tx.Exec(ctx, "SET statement_timeout=0")
if err != nil {
return fmt.Errorf("failed to set statement_timeout: %w", err)
}
_, err = tx.Exec(ctx, "SET idle_in_transaction_session_timeout=0")
if err != nil {
return fmt.Errorf("failed to set idle_in_transaction_session_timeout: %w", err)
}
_, err = tx.Exec(ctx, "SET lock_timeout=0")
if err != nil {
return fmt.Errorf("failed to set lock_timeout: %w", err)
}

for _, dstTableName := range destinationTables {
dstSchemaTable, err := utils.ParseSchemaTable(dstTableName)
if err != nil {
Expand Down

0 comments on commit 8583d62

Please sign in to comment.