-
Notifications
You must be signed in to change notification settings - Fork 2.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
Adds urnBasedPagination option to datahub-upgrade RestoreIndices #9232
Adds urnBasedPagination option to datahub-upgrade RestoreIndices #9232
Conversation
…ade RestoreIndices
0619c34
to
d1d0ea5
Compare
713101d
to
1edcb42
Compare
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.
Thanks for the contribution! This is great, a couple of minor comments
datahub-upgrade/src/main/java/com/linkedin/datahub/upgrade/restoreindices/SendMAEStep.java
Outdated
Show resolved
Hide resolved
datahub-upgrade/src/main/java/com/linkedin/datahub/upgrade/restoreindices/SendMAEStep.java
Outdated
Show resolved
Hide resolved
…Step when urnBasedPagination is true
@RyanHolstien Thanks for the review, I addressed your comments in the latest commit. Right now I have urnBasedPagination default to false, should I change the default value to true? |
@RyanHolstien Updated the query a bit based on our results. With this change, we were able to complete RestoreIndices on ~66 million aspects in ~5 hours. |
@@ -163,7 +153,8 @@ public Function<UpgradeContext, UpgradeStepResult> executable() { | |||
context.report().addLine(String.format("Rows processed this loop %d", rowsProcessed)); | |||
start += args.batchSize; | |||
} catch (InterruptedException | ExecutionException e) { | |||
e.printStackTrace(); | |||
context.report().addLine(String.format("Exception received while processing batch, exiting: %s", e.getMessage())); | |||
break; |
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.
Confused on the usage of break here, was thinking this should be a failure condition where it does:
return new DefaultUpgradeStepResult(id(), UpgradeStepResult.Result.FAILED);
what was the idea around the break intended for?
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 wasn't aware that's how failure conditions should be handled, I'll get that updated
validateConnection(); | ||
|
||
List<EbeanAspectV2.PrimaryKey> keys = | ||
urnAspects.entrySet().stream() |
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.
There are a lot of reformatting changes that got put into this PR that make it hard to see what has actually been changed
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.
That's all from this PR: #9373
Do you know what was run to do the formatting for that PR so that I can run it on my changes?
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 believe it's through Spotless which seems to be run through ./gradlew spotlessApply
, might need to be run at a per module basis I haven't used it yet personally so haven't worked through the kinks myself yet. It might also work itself out when updating the branch which we can try.
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.
Yeah merge did not fix it, it's showing that the lines got specifically changed from the new format to old format in this PR 😕
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.
The build output gives the command: ./gradlew :metadata-service:services:spotlessApply
should fix it
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.
Thanks, that fixed it. I think everything should be good now
I have suffered long upgrades because of |
I found that it is much better if I added an index. (useful before the release)
(a query form restoring is |
We found that the RestoreIndices job in datahub-upgrade performs poorly with large amounts of data in the SQL database. What we were seeing before this change was that as RestoreIndices ran, each batch would take longer and longer, with the bottleneck being SQL. The reason for this is that using OFFSET causes queries to slowdown as the OFFSET value gets higher.
This solution uses Keyset Pagination by saving the most recent urn and aspect that has been processed. The former method is still part of RestoreIndices, with the flag
urnBasedPagination
being set to true to use the new keyset pagination method. From our internal testing, we saw full restoration of ~5M records go from 4-5 hours to 40 minutes with linear execution instead of getting slower over time. The downside to this implementation is that currently I haven't added support for multiple threads. However, in most cases this implementation should be must faster than before, since in our example comparison, that was with 32 threads against the new implementation's single thread.Checklist