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

cleaning up Avro files for Snowflake CDC #781

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions flow/connectors/snowflake/qrep_avro_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (s *SnowflakeAvroSyncMethod) SyncRecords(
"destinationTable": dstTableName,
}).Infof("copying records into %s from stage %s", s.config.DestinationTableIdentifier, stage)

return numRecords, nil
return numRecords, os.Remove(localFilePath)
}

func (s *SnowflakeAvroSyncMethod) SyncQRepRecords(
Expand Down Expand Up @@ -275,8 +275,9 @@ func (s *SnowflakeAvroSyncMethod) writeToAvroFile(
var numRecords int
if s.config.StagingPath == "" {
ocfWriter := avro.NewPeerDBOCFWriterWithCompression(s.connector.ctx, stream, avroSchema)
tmpDir, err := os.MkdirTemp("", "peerdb-avro")
if err != nil {
tmpDir := fmt.Sprintf("%s/peerdb-avro-%s", os.TempDir(), flowJobName)
err := os.Mkdir(tmpDir, os.ModePerm)
if err != nil && !os.IsExist(err) {
return 0, "", fmt.Errorf("failed to create temp dir: %w", err)
}

Expand Down
Loading