You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/operation/AbstractStreamOperation.kt
+45-8Lines changed: 45 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,9 @@ abstract class AbstractStreamOperation<DestinationState : MinimumDestinationStat
// It's possible to "resume" a truncate sync that was previously already finalized.
176
+
// In this case, there is no existing temp raw table, and there is a real raw table
177
+
// which already belongs to the correct generation.
178
+
// Check for that case now.
179
+
val realStageGeneration = storageOperation.getStageGeneration(stream.id, NO_SUFFIX)
180
+
if (realStageGeneration ==null|| realStageGeneration == stream.generationId) {
181
+
log.info {
182
+
"${stream.id.originalNamespace}.${stream.id.originalName}: truncate sync, no existing temp raw table, and existing real raw table belongs to generation $realStageGeneration (== current generation ${stream.generationId}). Retaining it."
183
+
}
184
+
// The real raw table is from the correct generation. Set up any other resources
185
+
// (staging file, etc.), but leave the table untouched.
"${stream.id.originalNamespace}.${stream.id.originalName}: truncate sync, existing real raw table belongs to generation $realStageGeneration (!= current generation ${stream.generationId}), and no preexisting temp raw table. Creating a temp raw table."
191
+
}
192
+
// We're initiating a new truncate refresh. Create a new temp stage.
@@ -258,14 +295,14 @@ abstract class AbstractStreamOperation<DestinationState : MinimumDestinationStat
258
295
// which is possible (`typeAndDedupe(streamConfig.id.copy(rawName = streamConfig.id.rawName
259
296
// + suffix))`
260
297
// but annoying and confusing.
261
-
if (isTruncateSync && streamSuccessful) {
298
+
if (isTruncateSync && streamSuccessful&& rawTableSuffix.isNotEmpty()) {
262
299
log.info {
263
-
"Overwriting raw table for ${streamConfig.id.originalNamespace}.${streamConfig.id.originalName} because this is a truncate sync and we received a stream success message."
300
+
"Overwriting raw table for ${streamConfig.id.originalNamespace}.${streamConfig.id.originalName} because this is a truncate sync, we received a stream success message, and are using a temporary raw table."
Copy file name to clipboardExpand all lines: airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/operation/AbstractStreamOperationTest.kt
+102-6Lines changed: 102 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ class AbstractStreamOperationTest {
0 commit comments