Skip to content

Commit

Permalink
Remove validation (#17280)
Browse files Browse the repository at this point in the history
* Remove validation

* Revert "Remove validation"

This reverts commit 156a227.

* Put the validation behind a feature flag

* Fix typo

* format
  • Loading branch information
benmoriceau authored Sep 27, 2022
1 parent a216147 commit 0404203
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class EnvVariableFeatureFlags implements FeatureFlags {

public static final String USE_STREAM_CAPABLE_STATE = "USE_STREAM_CAPABLE_STATE";
public static final String LOG_CONNECTOR_MESSAGES = "LOG_CONNECTOR_MESSAGES";
public static final String NEED_STATE_VALIDATION = "NEED_STATE_VALIDATION";

@Override
public boolean autoDisablesFailingConnections() {
Expand Down Expand Up @@ -40,6 +41,11 @@ public boolean logConnectorMessages() {
return getEnvOrDefault(LOG_CONNECTOR_MESSAGES, false, Boolean::parseBoolean);
}

@Override
public boolean needStateValidation() {
return getEnvOrDefault(NEED_STATE_VALIDATION, true, Boolean::parseBoolean);
}

// TODO: refactor in order to use the same method than the ones in EnvConfigs.java
public <T> T getEnvOrDefault(final String key, final T defaultValue, final Function<String, T> parser) {
final String value = System.getenv(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ public interface FeatureFlags {

boolean logConnectorMessages();

boolean needStateValidation();

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public boolean persist(final UUID connectionId, final StandardSyncOutput syncOut
if (maybeStateWrapper.isPresent()) {
final ConnectionState previousState = airbyteApiClient.getConnectionApi()
.getState(new ConnectionIdRequestBody().connectionId(connectionId));
if (previousState != null) {
if (featureFlags.needStateValidation() && previousState != null) {
final StateType newStateType = maybeStateWrapper.get().getStateType();
final StateType prevStateType = convertClientStateTypeToInternal(previousState.getStateType());

Expand Down

0 comments on commit 0404203

Please sign in to comment.