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

feat(bootstrap): add bootstrap step to clear out unknown aspect rows from the database #5148

Merged

Conversation

RyanHolstien
Copy link
Collaborator

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

Copy link
Contributor

@dexter-mh-lee dexter-mh-lee left a comment

Choose a reason for hiding this comment

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

Doing a full mysql scan on each deploy seems very dangerous. Also would take forever. Simple listUrns function took a long time (more than 10 minutes) on big instances

@github-actions
Copy link

github-actions bot commented Jun 10, 2022

Unit Test Results (build & test)

385 tests  +4   385 ✔️ +4   10m 47s ⏱️ + 7m 13s
  91 suites +2       0 💤 ±0 
  91 files   +2       0 ±0 

Results for commit c2824d3. ± Comparison against base commit 1b50709.

♻️ This comment has been updated with latest results.

public class EntityAspectIdentifier {
@Nonnull String urn;
@Nonnull String aspect;
long version;

public static EntityAspectIdentifier fromEbean(EbeanAspectV2 ebeanAspectV2) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I really dislike the naming inconsistency of EbeanAspectV2 and CassandraAspect :( Seems very strange that this class needs to know about specific DB implementations, also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a utility conversion from the lower level aspect, made more sense here to me tied to the actual higher level object it will always be used with than in a separate utility class that will never be found by others trying to do the same thing.

// Validate pre-conditions before running queries
Urn entityUrn;
EntitySpec entitySpec;
try {
entityUrn = Urn.createFromString(urn);
String entityName = PegasusUtils.urnToEntityName(entityUrn);
entitySpec = getEntityRegistry().getEntitySpec(entityName);
Preconditions.checkState(entitySpec != null, String.format("Could not find entity definition for %s", entityName));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One of them doesn't actually do anything since it will never be triggered and the other one prevents the delete from going through.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why would it prevent the delete?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we always populate the "aspectName" field?

@jjoyce0510 jjoyce0510 merged commit ba21efc into datahub-project:master Jun 21, 2022
shirshanka pushed a commit to shirshanka/datahub that referenced this pull request Jun 22, 2022
alexey-kravtsov pushed a commit to infobip/datahub that referenced this pull request Jul 8, 2022
maggiehays pushed a commit to maggiehays/datahub that referenced this pull request Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants