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

cleanup local Avro files, and fixed directory #767

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

heavycrystal
Copy link
Contributor

No description provided.

Comment on lines 143 to +146
if err != nil {
return 0, err
}

if localFilePath != "" {
defer func() {
log.Infof("removing temp file %s", localFilePath)
err := os.Remove(localFilePath)
if err != nil {
log.WithFields(log.Fields{
"flowName": config.FlowJobName,
"partitionID": partition.PartitionId,
"destinationTable": dstTableName,
}).Errorf("failed to remove temp file %s: %v", localFilePath, err)
}
}()
}
defer avroFile.Cleanup()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can there be an error in the middle of writing the file and lead to a file still being left around?
in that case we'll return the error, but not cleanup.

Similar cases below

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving to land this to remediate an issue and filed an issue for the real fox

@iskakaushik iskakaushik merged commit d79aef6 into main Dec 7, 2023
13 checks passed
@serprex serprex deleted the local-avro-files-cleanup branch July 19, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants