Skip to content
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

Bmoric/complete first sync #7832

Merged
merged 35 commits into from
Nov 18, 2021
Merged

Bmoric/complete first sync #7832

merged 35 commits into from
Nov 18, 2021

Conversation

benmoriceau
Copy link
Contributor

@benmoriceau benmoriceau commented Nov 10, 2021

What

After a sync is completed, we tag all the workspace with related to this sync as having a first sync completed.

This will then be forwarded to the UI in another PR.

This is part of #5884

@github-actions github-actions bot added area/platform issues related to the platform area/scheduler labels Nov 10, 2021
@benmoriceau benmoriceau temporarily deployed to more-secrets November 10, 2021 22:20 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 10, 2021 22:23 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 10, 2021 23:13 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 11, 2021 18:19 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 11, 2021 19:20 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 11, 2021 23:36 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 12, 2021 22:03 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 12, 2021 22:17 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 12, 2021 22:20 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 12, 2021 22:25 Inactive
@benmoriceau benmoriceau requested a review from jrhizor November 12, 2021 22:29
@benmoriceau benmoriceau marked this pull request as ready for review November 12, 2021 22:29
@benmoriceau benmoriceau temporarily deployed to more-secrets November 12, 2021 22:31 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 16, 2021 01:08 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 00:47 Inactive
@@ -141,6 +175,7 @@ public void testFailure() throws Exception {
inOrder.verify(persistence).failAttempt(JOB_ID, ATTEMPT_NUMBER);
verify(jobTracker).trackSync(job, JobState.FAILED);
inOrder.verifyNoMoreInteractions();
verifyNoInteractions(configRepository);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}

};
writeConfigs(configType, configIdToConfig);
database.transaction(ctx -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the rest of this be removed? Looks like it's writing twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch, it was a mistake

@@ -133,6 +140,19 @@ void submitJob(final Job job) {

if (output.getStatus() == io.airbyte.workers.JobStatus.SUCCEEDED) {
persistence.succeedAttempt(job.getId(), attemptNumber);

final List<StandardWorkspace> standardWorkspaces = configRepository.listStandardWorkspaces(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an expensive scan. Can we just get the workspace for this specific sync job run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be ideal and it was my first option. How ever I never managed to access to the workspace Id here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

job.getScope() is the connection id for a sync, which can be used to retrieve the workspace id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

.collect(Collectors.toList());

configRepository.writeStandardWorkspaces(workspacesToUpdate);

if (job.getConfigType() == ConfigType.SYNC) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above should only go in the SYNC here. Otherwise check connection will trigger this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 18:16 Inactive
@benmoriceau benmoriceau requested a review from jrhizor November 17, 2021 18:20
@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 18:26 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 20:06 Inactive
@benmoriceau
Copy link
Contributor Author

@jrhizor The comments have been addressed.

@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 22:04 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 22:25 Inactive

final OffsetDateTime timestamp = OffsetDateTime.now();
final OffsetDateTime timestamp = OffsetDateTime.now();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go outside of the loop so all of the inserted records have the same timestamp for the transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@jrhizor jrhizor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor comment but otherwise looks good

@benmoriceau
Copy link
Contributor Author

one minor comment but otherwise looks good

Cool, I will merge if the build is green.

@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 23:45 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets November 17, 2021 23:53 Inactive
@benmoriceau benmoriceau merged commit 0d51742 into master Nov 18, 2021
@benmoriceau benmoriceau deleted the bmoric/complete-first-sync branch November 18, 2021 00:12
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
After a sync is completed, we tag all the workspace with related to this sync as having a first sync completed.

This will then be forwarded to the UI in another PR.

This is part of airbytehq#5884
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Related to the api area/documentation Improvements or additions to documentation area/platform issues related to the platform area/scheduler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants