-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Change where a connection is deleted #19096
Changes from 6 commits
b28e09f
2aeae06
17f8a23
c19a90c
87eb1cb
1134d27
058c3a6
b93112e
28a89f0
923c277
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 |
---|---|---|
|
@@ -213,11 +213,15 @@ public void deleteSource(final SourceRead source) | |
final var workspaceIdRequestBody = new WorkspaceIdRequestBody() | ||
.workspaceId(source.getWorkspaceId()); | ||
|
||
connectionsHandler.listConnectionsForWorkspace(workspaceIdRequestBody) | ||
final List<UUID> uuidsToDelete = connectionsHandler.listConnectionsForWorkspace(workspaceIdRequestBody) | ||
.getConnections().stream() | ||
.filter(con -> con.getSourceId().equals(source.getSourceId())) | ||
.map(ConnectionRead::getConnectionId) | ||
.forEach(connectionsHandler::deleteConnection); | ||
.toList(); | ||
|
||
for (final UUID uuidToDelete : uuidsToDelete) { | ||
connectionsHandler.deleteConnection(uuidToDelete); | ||
} | ||
Comment on lines
+220
to
+224
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. You could instead call 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. It is done on purpose in order to have the exception thrown by |
||
|
||
final var spec = getSpecFromSourceId(source.getSourceId()); | ||
final var fullConfig = secretsRepositoryReader.getSourceConnectionWithSecrets(source.getSourceId()).getConfiguration(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,9 @@ public class ConnectionManagerWorkflowImpl implements ConnectionManagerWorkflow | |
private static final String CHECK_JOB_OUTPUT_TAG = "check_job_output"; | ||
private static final int CHECK_JOB_OUTPUT_TAG_CURRENT_VERSION = 1; | ||
|
||
private static final String DONT_DELETE_IN_TEMPORAL_TAG = "dont_delete_in_temporal"; | ||
private static final int DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION = 1; | ||
|
||
private static final String DELETE_RESET_JOB_STREAMS_TAG = "delete_reset_job_streams"; | ||
private static final int DELETE_RESET_JOB_STREAMS_CURRENT_VERSION = 1; | ||
private static final String RECORD_METRIC_TAG = "record_metric"; | ||
|
@@ -179,9 +182,13 @@ public void run(final ConnectionUpdaterInput connectionUpdaterInput) throws Retr | |
new RecordMetricInput(connectionUpdaterInput, Optional.of(FailureCause.CANCELED), OssMetricsRegistry.TEMPORAL_WORKFLOW_FAILURE, null)); | ||
} | ||
|
||
if (workflowState.isDeleted()) { | ||
final int dontDeleteInTemporal = | ||
Workflow.getVersion(DONT_DELETE_IN_TEMPORAL_TAG, Workflow.DEFAULT_VERSION, DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION); | ||
|
||
if (dontDeleteInTemporal < DONT_DELETE_IN_TEMPORAL_TAG_CURRENT_VERSION && workflowState.isDeleted()) { | ||
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. This is not placed in the right place, if should be on like 195. I moved the PR back to a draft. |
||
if (workflowState.isRunning()) { | ||
log.info("Cancelling the current running job because a connection deletion was requested"); | ||
// This call is not needed anymore since this will be cancel using the the cancellation state | ||
reportCancelled(connectionUpdaterInput.getConnectionId()); | ||
} | ||
log.info("Workflow deletion was requested. Calling deleteConnection activity before terminating the workflow."); | ||
|
@@ -503,6 +510,7 @@ public void cancelJob() { | |
cancellableSyncWorkflow.cancel(); | ||
} | ||
|
||
// TODO: Delete when the don't delete in temporal is removed | ||
@Trace(operationName = WORKFLOW_TRACE_OPERATION_NAME) | ||
@Override | ||
public void deleteConnection() { | ||
|
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.
nit: can we log the exception?
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.
Opps, I forget that. Will update.
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.
Done