-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Job Persistence Refactor in preparation for progress bar. #18891
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
Conversation
…nd an attempt number.
@@ -29,14 +29,14 @@ | |||
import java.util.stream.Stream; | |||
|
|||
/** | |||
* TODO Introduce a locking mechanism so that no DB operation is allowed when automatic migration is |
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.
This comment is out of date. I replaced it with something more useful.
@@ -382,6 +365,24 @@ public void writeOutput(final long jobId, final int attemptNumber, final JobOutp | |||
|
|||
} | |||
|
|||
private static void writeSyncStats(final OffsetDateTime now, final SyncStats syncStats, final Long attemptId, final DSLContext ctx) { |
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.
I pulled this out as I will reuse this in follow up PRs as I implement the progress bar logic.
@@ -285,13 +285,7 @@ void testWriteOutput() throws IOException, SQLException { | |||
assertEquals(Optional.of(jobOutput), updated.getAttempts().get(0).getOutput()); | |||
assertNotEquals(created.getAttempts().get(0).getUpdatedAtInSecond(), updated.getAttempts().get(0).getUpdatedAtInSecond()); | |||
|
|||
final Optional<Record> record = |
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.
Replacing jobId and attemptNumber also simplifies how the methods are used.
The alternative is exposing a helper method to calculate the attemptId
- this feels unnecessary.
@davinchia Looks like the build failed due to a formatting issues. |
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.
What
Some refactoring in preparation for the progress bar persistence changes.
The main change here was to simplify some of the
JobPersistence
methods by moving the logic to calculateattemptId
into theJobPersistence
implementation. This logic currently sits outside the class and is duplicated in multiple places. We could expose a helper method to calculate this logic, however that felt unnecessary at this point.The alternative is further duplicating this logic as the progress bar logic is implemented, so I want to get that out of the way.
The other reason it's cleaner to use
jobId
andattemptNumber
is these concepts/terms are more familiar throughout the rest of the codebase and it feels more intuitive to continue speaking this language (in my opinion).Some random bits I wanted to clean up on the way as well. I will leave comments in the files as appropriate.
How
getSyncStats(Long attemptId)
->getSyncStats(long jobId, int attemptNumber)
getNormalizationSummary(Long attemptId)
->getNormalizationSummary(long jobId, int attemptNumber)
I also pulled out method that I will need to use in follow up PRs.
Recommended reading order
JobPersistence.java
for the main changes.🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.