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

Fix duplicate entities #264

Merged
merged 1 commit into from
Sep 13, 2019
Merged

Conversation

steven-sheehy
Copy link
Member

Detailed description:

  • Changes unique index and lookup criteria for t_entities to be (entity_shard, entity_realm, entity_num)
  • Migrates duplicate entities that have both account and contract to use the contract entity

Which issue(s) this PR fixes:
Fixes #251

Special notes for your reviewer:
The contract is always created first for these dupes, hence why min(id) chooses the contract entity in the migration

Checklist

  • Documentation added
  • Tests updated

Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
@steven-sheehy steven-sheehy added bug Type: Something isn't working P1 database Area: Database labels Sep 13, 2019
@steven-sheehy steven-sheehy added this to the 0.2.0 milestone Sep 13, 2019
Copy link
Contributor

@mike-burrage-hedera mike-burrage-hedera left a comment

Choose a reason for hiding this comment

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

Looks good. rc2

@mike-burrage-hedera mike-burrage-hedera merged commit 3d925ba into master Sep 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the bug/duplicate-entities branch September 13, 2019 22:34
Copy link
Contributor

@gregscullard gregscullard left a comment

Choose a reason for hiding this comment

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

The postgres function f_entity_create also needs updating

  SELECT id
  INTO entity_id
  FROM t_entities
  WHERE entity_shard = _shard
  AND   entity_realm = _realm
  AND   entity_num = _num
  AND   fk_entity_type_id = _type_id;

Suggest removal of last line of where clause (And fk_entity_type = ...).

It is defined in sql migrations v1.3__procedures.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working database Area: Database P1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate entities
3 participants