Skip to content

Commit d790b7d

Browse files
authored
[Source-postgres] : Better error messages on switching between sync m… (#37509)
1 parent b5fef4e commit d790b7d

File tree

6 files changed

+242
-234
lines changed

6 files changed

+242
-234
lines changed

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/AirbyteTraceMessageUtility.kt

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ object AirbyteTraceMessageUtility {
1919
emitErrorTrace(e, displayMessage, AirbyteErrorTraceMessage.FailureType.CONFIG_ERROR)
2020
}
2121

22+
@JvmStatic
23+
fun emitTransientErrorTrace(e: Throwable, displayMessage: String?) {
24+
emitErrorTrace(e, displayMessage, AirbyteErrorTraceMessage.FailureType.SYSTEM_ERROR)
25+
}
26+
2227
fun emitCustomErrorTrace(displayMessage: String?, internalMessage: String?) {
2328
emitMessage(
2429
makeAirbyteMessageFromTraceMessage(
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
testExecutionConcurrency=-1
22

3-
JunitMethodExecutionTimeout=2 m
3+
JunitMethodExecutionTimeout=5 m

airbyte-integrations/connectors/source-postgres/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data:
99
connectorSubtype: database
1010
connectorType: source
1111
definitionId: decd338e-5647-4c0b-adf4-da0e75f5a750
12-
dockerImageTag: 3.3.27
12+
dockerImageTag: 3.3.28
1313
dockerRepository: airbyte/source-postgres
1414
documentationUrl: https://docs.airbyte.com/integrations/sources/postgres
1515
githubIssueLabel: source-postgres

airbyte-integrations/connectors/source-postgres/src/main/java/io/airbyte/integrations/source/postgres/cursor_based/CursorBasedCtidUtils.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.fasterxml.jackson.databind.JsonNode;
1212
import io.airbyte.cdk.integrations.source.relationaldb.state.StateManager;
13+
import io.airbyte.commons.exceptions.ConfigErrorException;
1314
import io.airbyte.integrations.source.postgres.ctid.CtidUtils.CtidStreams;
1415
import io.airbyte.integrations.source.postgres.ctid.CtidUtils.StreamsCategorised;
1516
import io.airbyte.integrations.source.postgres.internal.models.InternalModels.StateType;
@@ -67,7 +68,7 @@ public static StreamsCategorised<CursorBasedStreams> categoriseStreams(final Sta
6768
cursorBasedSyncStreamPairs.add(pair);
6869
statesFromCursorBasedSync.add(stateMessage);
6970
} else {
70-
throw new RuntimeException("Unknown state type: " + streamState.get(STATE_TYPE_KEY).asText());
71+
throw new ConfigErrorException("You've changed replication modes - please reset the streams in this connector");
7172
}
7273
} else {
7374
LOGGER.info("State type not present, syncing stream {} via cursor", streamDescriptor.getName());

airbyte-integrations/connectors/source-postgres/src/main/java/io/airbyte/integrations/source/postgres/xmin/XminCtidUtils.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.fasterxml.jackson.databind.JsonNode;
1212
import io.airbyte.cdk.integrations.source.relationaldb.state.StateManager;
13+
import io.airbyte.commons.exceptions.ConfigErrorException;
1314
import io.airbyte.commons.json.Jsons;
1415
import io.airbyte.integrations.source.postgres.ctid.CtidUtils.CtidStreams;
1516
import io.airbyte.integrations.source.postgres.ctid.CtidUtils.StreamsCategorised;
@@ -72,7 +73,7 @@ public static StreamsCategorised<XminStreams> categoriseStreams(final StateManag
7273
statesFromXminSync.add(stateMessage);
7374
}
7475
} else {
75-
throw new RuntimeException("Unknown state type: " + streamState.get(STATE_TYPE_KEY).asText());
76+
throw new ConfigErrorException("You've changed replication modes - please reset the streams in this connector");
7677
}
7778
} else {
7879
throw new RuntimeException("State type not present");

0 commit comments

Comments
 (0)