-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export/csv: prepend a unique id to file name of csv exports
Addresses #50580 When exporting CSV files, a failed & repeated export will use the same file names. This can result in an error if an overwrite is disallowed, but more importantly, it can result in a directory containing files from different export runs. This can represent inconsistent data if the previous export was not deleted. This commit prepends a unique export ID to the file name. The ID is the queryID from the sql.Statement struct. This choice seems to guarantee the most uniqueness. It's 128 bits, and encoded as hex. Other ID options considered were random int, timestamp, and transaction ID. Each of these has a small risk of collision. Related tests were updated and are (should be) passing. Some formatting and renaming for clarity; `exportNode.fileName` is now `exportNode.destination`. `chunkSize` is now `chunkRows`. Release note (enterprise change): Exported CSV files are now prepended with a long unique ID. This can help to mitigate situations where multiple export runs are written to the same directory, resulting in mixed data. This change does not prevent mixed data; rather, it makes it possible to identify files from distinct runs, so that an operator can clean up.
- Loading branch information
1 parent
fdf54eb
commit 59dae5d
Showing
5 changed files
with
105 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters