-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bmoric/right error for refresh (#22471)
* Get a better failure reason for the refresh schema error * Use share empty stats * Format * Add missing import * fix pmd
- Loading branch information
1 parent
3d2a995
commit f9939c7
Showing
6 changed files
with
63 additions
and
28 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
39 changes: 39 additions & 0 deletions
39
airbyte-workers/src/main/java/io/airbyte/workers/temporal/sync/SyncOutputProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.temporal.sync; | ||
|
||
import io.airbyte.config.FailureReason; | ||
import io.airbyte.config.StandardSyncOutput; | ||
import io.airbyte.config.StandardSyncSummary; | ||
import io.airbyte.config.SyncStats; | ||
import java.util.List; | ||
|
||
public class SyncOutputProvider { | ||
|
||
public final static StandardSyncSummary EMPTY_FAILED_SYNC = new StandardSyncSummary() | ||
.withStatus(StandardSyncSummary.ReplicationStatus.FAILED) | ||
.withStartTime(System.currentTimeMillis()) | ||
.withEndTime(System.currentTimeMillis()) | ||
.withRecordsSynced(0L) | ||
.withBytesSynced(0L) | ||
.withTotalStats(new SyncStats() | ||
.withRecordsEmitted(0L) | ||
.withBytesEmitted(0L) | ||
.withSourceStateMessagesEmitted(0L) | ||
.withDestinationStateMessagesEmitted(0L) | ||
.withRecordsCommitted(0L)); | ||
|
||
public static StandardSyncOutput getRefreshSchemaFailure(final Exception e) { | ||
return new StandardSyncOutput() | ||
.withFailures(List.of(new FailureReason() | ||
.withFailureType(FailureReason.FailureType.REFRESH_SCHEMA) | ||
.withFailureOrigin(FailureReason.FailureOrigin.SOURCE) | ||
.withExternalMessage("Failed to detect if there is a schema change. If the error persist please contact the support team.") | ||
.withInternalMessage("Failed to launch the refresh schema activity because of: " + e.getMessage()) | ||
.withStacktrace(e.toString()))) | ||
.withStandardSyncSummary(EMPTY_FAILED_SYNC); | ||
} | ||
|
||
} |
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