-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add back in Auto detect schema functionality in sync workflow #21361
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
import static io.airbyte.metrics.lib.ApmTraceConstants.WORKFLOW_TRACE_OPERATION_NAME; | ||
|
||
import datadog.trace.api.Trace; | ||
import io.airbyte.api.client.model.generated.ConnectionStatus; | ||
import io.airbyte.commons.temporal.scheduling.SyncWorkflow; | ||
import io.airbyte.config.NormalizationInput; | ||
import io.airbyte.config.NormalizationSummary; | ||
|
@@ -21,12 +22,16 @@ | |
import io.airbyte.config.StandardSyncOperation; | ||
import io.airbyte.config.StandardSyncOperation.OperatorType; | ||
import io.airbyte.config.StandardSyncOutput; | ||
import io.airbyte.config.StandardSyncSummary; | ||
import io.airbyte.config.StandardSyncSummary.ReplicationStatus; | ||
import io.airbyte.config.SyncStats; | ||
import io.airbyte.config.WebhookOperationSummary; | ||
import io.airbyte.metrics.lib.ApmTraceUtils; | ||
import io.airbyte.persistence.job.models.IntegrationLauncherConfig; | ||
import io.airbyte.persistence.job.models.JobRunConfig; | ||
import io.airbyte.protocol.models.ConfiguredAirbyteCatalog; | ||
import io.airbyte.workers.temporal.annotations.TemporalActivityStub; | ||
import io.airbyte.workers.temporal.scheduling.activities.ConfigFetchActivity; | ||
import io.temporal.workflow.Workflow; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
@@ -57,11 +62,10 @@ public class SyncWorkflowImpl implements SyncWorkflow { | |
private NormalizationSummaryCheckActivity normalizationSummaryCheckActivity; | ||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private WebhookOperationActivity webhookOperationActivity; | ||
// Temporarily disabled to address OC issue #1210 | ||
// @TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
// private RefreshSchemaActivity refreshSchemaActivity; | ||
// @TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
// private ConfigFetchActivity configFetchActivity; | ||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private RefreshSchemaActivity refreshSchemaActivity; | ||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private ConfigFetchActivity configFetchActivity; | ||
|
||
@Trace(operationName = WORKFLOW_TRACE_OPERATION_NAME) | ||
@Override | ||
|
@@ -80,30 +84,26 @@ public StandardSyncOutput run(final JobRunConfig jobRunConfig, | |
final int version = Workflow.getVersion(VERSION_LABEL, Workflow.DEFAULT_VERSION, CURRENT_VERSION); | ||
final String taskQueue = Workflow.getInfo().getTaskQueue(); | ||
|
||
// Temporarily suppressed to address OC issue #1210 | ||
@SuppressWarnings("PMD.UnusedLocalVariable") | ||
final int autoDetectSchemaVersion = | ||
Workflow.getVersion(AUTO_DETECT_SCHEMA_TAG, Workflow.DEFAULT_VERSION, AUTO_DETECT_SCHEMA_VERSION); | ||
|
||
// Temporarily disabled to address OC issue #1210 | ||
// if (autoDetectSchemaVersion >= AUTO_DETECT_SCHEMA_VERSION) { | ||
// final Optional<UUID> sourceId = configFetchActivity.getSourceId(connectionId); | ||
// | ||
// if (!sourceId.isEmpty() && refreshSchemaActivity.shouldRefreshSchema(sourceId.get())) { | ||
// LOGGER.info("Refreshing source schema..."); | ||
// refreshSchemaActivity.refreshSchema(sourceId.get(), connectionId); | ||
// } | ||
// | ||
// final Optional<Status> status = configFetchActivity.getStatus(connectionId); | ||
// if (!status.isEmpty() && Status.INACTIVE == status.get()) { | ||
// LOGGER.info("Connection is disabled. Cancelling run."); | ||
// final StandardSyncOutput output = | ||
// new StandardSyncOutput() | ||
// .withStandardSyncSummary(new | ||
// StandardSyncSummary().withStatus(ReplicationStatus.CANCELLED).withTotalStats(new SyncStats())); | ||
// return output; | ||
// } | ||
// } | ||
if (autoDetectSchemaVersion >= AUTO_DETECT_SCHEMA_VERSION) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we will need a new version here. Since it wasn't commented out, the version will be in the history and even old workflow will run into undeterministic exception. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated AUTO_DETECT_SCHEMA_VERSION to 2. is that what you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that will work |
||
final Optional<UUID> sourceId = configFetchActivity.getSourceId(connectionId); | ||
|
||
if (!sourceId.isEmpty() && refreshSchemaActivity.shouldRefreshSchema(sourceId.get())) { | ||
LOGGER.info("Refreshing source schema..."); | ||
refreshSchemaActivity.refreshSchema(sourceId.get(), connectionId); | ||
} | ||
|
||
final Optional<ConnectionStatus> status = configFetchActivity.getStatus(connectionId); | ||
if (!status.isEmpty() && ConnectionStatus.INACTIVE == status.get()) { | ||
LOGGER.info("Connection is disabled. Cancelling run."); | ||
final StandardSyncOutput output = | ||
new StandardSyncOutput() | ||
.withStandardSyncSummary(new StandardSyncSummary().withStatus(ReplicationStatus.CANCELLED).withTotalStats(new SyncStats())); | ||
return output; | ||
} | ||
} | ||
|
||
StandardSyncOutput syncOutput = | ||
replicationActivity.replicate(jobRunConfig, sourceLauncherConfig, destinationLauncherConfig, syncInput, taskQueue); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check, are all the issue related to this ticket solved? and is there a way to test it in dev?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the config repository is removed from all activities (config fetch activity & refresh schema activity). I'm not sure how to test this in the data plane. @jdpgrailsdev do you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can at least test it locally to verify that the application starts up in "data plane" mode. This will at least test the problem we saw in production with the missing data source. Additionally, cloud now has "data plane" acceptance tests, which performs a sync in the data plane. That should also fail if there is still a problem related to this.