Skip to content

Commit fa897de

Browse files
authored
use .tmp suffix instead of /tmp (#1447)
1 parent c9949de commit fa897de

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

debezium-server-voyager/debezium-server-voyagerexporter/src/main/java/io/debezium/server/ybexporter/ExportStatus.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ public void updateTableSchema(Table t) {
164164
if ((sourceType.equals("postgresql") || sourceType.equals("yb")) && (!t.schemaName.equals("public"))) {
165165
fileName = t.schemaName + "." + fileName;
166166
}
167-
String tempPath = String.format("/tmp/%s_%s_schema.json", exporterRole, fileName);
168-
File tempFile = new File(tempPath);
169167
String schemaFilePath = String.format("%s/schemas/%s/%s_schema.json", dataDir, exporterRole, fileName);
170168
File schemaFile = new File(schemaFilePath);
169+
String tempPath = String.format("%s.tmp", schemaFilePath);
170+
File tempFile = new File(tempPath);
171171
// writing to a temp file and moving later to achieve atomic write.
172172
schemaWriter.writeValue(tempFile, tableSchema);
173173
Files.move(tempFile.toPath(), schemaFile.toPath(), ATOMIC_MOVE);

yb-voyager/src/utils/schemareg/schemaRegistry.go

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func (sreg *SchemaRegistry) Init() error {
123123
return fmt.Errorf("failed to read schema dir %s: %w", schemaDir, err)
124124
}
125125
for _, schemaFile := range schemaFiles {
126+
if strings.HasSuffix(schemaFile.Name(), ".tmp") {
127+
continue
128+
}
126129
schemaFilePath := filepath.Join(schemaDir, schemaFile.Name())
127130
schemaFile, err := os.Open(schemaFilePath)
128131
if err != nil {

0 commit comments

Comments
 (0)