Skip to content

Commit 8f874b6

Browse files
authored
fix(main): Truncate sync time to microsecond (#13484)
Fixes #13457 If we have a destination that supports timestamps with precisions higher than microsecond (like MSSQL), we may end up removing all previously written data in `overwrite-delete-stale` mode. We already solved it once for Snowflake in #10354
1 parent 56d0e45 commit 8f874b6

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

cli/cmd/sync_v1.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func syncConnectionV1(ctx context.Context, sourceClient *managedplugin.Client, d
3333
}
3434
}
3535
}()
36-
syncTime := time.Now().UTC()
36+
// https://github.com/golang/go/issues/41087
37+
syncTime := time.Now().UTC().Truncate(time.Microsecond)
3738
destinationStrings := make([]string, len(destinationsClients))
3839
for i := range destinationsClients {
3940
destinationStrings[i] = destinationSpecs[i].VersionString()

cli/cmd/sync_v2.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ func syncConnectionV2(ctx context.Context, sourceClient *managedplugin.Client, d
8989
}
9090
}
9191
}()
92-
syncTime := time.Now().UTC()
92+
// https://github.com/golang/go/issues/41087
93+
syncTime := time.Now().UTC().Truncate(time.Microsecond)
9394
destinationStrings := make([]string, len(destinationsClients))
9495
for i := range destinationsClients {
9596
destinationStrings[i] = destinationSpecs[i].VersionString()

cli/cmd/sync_v3.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ func syncConnectionV3(ctx context.Context, source v3source, destinations []v3des
5353
}
5454
}
5555
}()
56-
syncTime := time.Now().UTC()
56+
// https://github.com/golang/go/issues/41087
57+
syncTime := time.Now().UTC().Truncate(time.Microsecond)
5758
sourceName := sourceSpec.Name
5859
destinationStrings := make([]string, len(destinationsClients))
5960
for i := range destinationsClients {

0 commit comments

Comments
 (0)