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(core-snapshots): avoid trying to INSERT duplicates in rounds #2651

Merged
merged 6 commits into from Jun 4, 2019

Conversation

Projects
None yet
5 participants
@vasild
Copy link
Contributor

commented Jun 3, 2019

Follow the logic of INSERTing into blocks and transactions also for
rounds: only INSERT a row during snapshot restore if its identifier
is higher than the highest in the database (ie a sloppy check whether
a row is in the database).

A summary of what changes this PR introduces and why they were made.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactor
  • Performance
  • Tests
  • Build
  • Documentation
  • Code style update
  • Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the develop branch, not the master branch
  • All tests are passing
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)
fix(core-snapshots): avoid trying to INSERT duplicates in rounds
Follow the logic of INSERTing into blocks and transactions also for
rounds: only INSERT a row during snapshot restore if its identifier
is higher than the highest in the database (ie a sloppy check whether
a row is in the database).
@codecov-io

This comment has been minimized.

Copy link

commented Jun 3, 2019

Codecov Report

Merging #2651 into develop will increase coverage by 0.17%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2651      +/-   ##
===========================================
+ Coverage    65.58%   65.76%   +0.17%     
===========================================
  Files          417      401      -16     
  Lines         8910     8781     -129     
  Branches       409      406       -3     
===========================================
- Hits          5844     5775      -69     
+ Misses        3016     2958      -58     
+ Partials        50       48       -2
Impacted Files Coverage Δ
...kages/core-snapshots/src/transport/verification.ts 0% <0%> (ø) ⬆️
packages/core-snapshots/src/manager.ts 0% <0%> (ø) ⬆️
...s/core-interfaces/src/core-database/event-types.ts
packages/core-transaction-pool/src/plugin.ts
...aces/src/core-database/search/search-parameters.ts
packages/core-blockchain/src/plugin.ts
packages/core-wallet-api/src/plugin.ts
packages/core-logger-winston/src/plugin.ts
packages/core-logger-pino/src/plugin.ts
packages/core-p2p/src/plugin.ts
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abe26ff...c75e651. Read the comment docs.

@supaiku0
Copy link
Contributor

left a comment

I run into an error when I do the following:

$ snapshot:dump
(forge some more blocks)
$ snapshot:dump --blocks previous-dump
...
$ snapshot:truncate
...
$ snapshot:restore
0sTypeError: Cannot read property 'id' of null
    at Object.exports.canImportRecord (~/git/ark-core/packages/core-snapshots/dist/transport/verification.js:63:44)
    at Object.exports.importTable (~/git/ark-core/packages/core-snapshots/dist/transport/index.js:84:28)

vasild added some commits Jun 4, 2019

Merge remote-tracking branch 'ArkEcosystem/core/develop' into fix-sna…
…pshot-rounds-dup

* ArkEcosystem/core/develop:
  fix(core-api): invalid orderBy causes internal server error (#2653)
  fix(core): set the correct channel if core was directly installed with @next (#2646)
  refactor(core-p2p): improve logging (#2652)
  misc(core-snapshots): fix the link to the documentation (#2650)
fix(core-snapshots): check for proper return value from getLastRound()
getLastRound() would return `null` and not `undefined` if the rounds
table is empty.
@vasild

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

I run into an error when I do the following:

$ snapshot:dump
(forge some more blocks)
$ snapshot:dump --blocks previous-dump
...
$ snapshot:truncate
...
$ snapshot:restore
0sTypeError: Cannot read property 'id' of null
    at Object.exports.canImportRecord (~/git/ark-core/packages/core-snapshots/dist/transport/verification.js:63:44)
    at Object.exports.importTable (~/git/ark-core/packages/core-snapshots/dist/transport/index.js:84:28)

Fixed in a6e5b0c.

fix(core-snapshots): use null to denote missing last block
So that it is consistent with the return value of getLastBlock()
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

The ci/circleci: node10-functional job is failing as of 74cd737c44b0d82f9ef5b0ecf5bf4c66c2790801. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

vasild and others added some commits Jun 4, 2019

chore(core-snapshots): silence tslint warning
manager.ts:52:32 - Use 'undefined' instead of 'null'

@supaiku0 supaiku0 self-requested a review Jun 4, 2019

@supaiku0 supaiku0 merged commit 84f32b8 into develop Jun 4, 2019

15 checks passed

ci/circleci: node10-benchmark Your tests passed on CircleCI!
Details
ci/circleci: node10-e2e Your tests passed on CircleCI!
Details
ci/circleci: node10-functional Your tests passed on CircleCI!
Details
ci/circleci: node10-integration Your tests passed on CircleCI!
Details
ci/circleci: node10-unit Your tests passed on CircleCI!
Details
ci/circleci: node11-benchmark Your tests passed on CircleCI!
Details
ci/circleci: node11-e2e Your tests passed on CircleCI!
Details
ci/circleci: node11-functional Your tests passed on CircleCI!
Details
ci/circleci: node11-integration Your tests passed on CircleCI!
Details
ci/circleci: node11-unit Your tests passed on CircleCI!
Details
ci/circleci: node12-benchmark Your tests passed on CircleCI!
Details
ci/circleci: node12-e2e Your tests passed on CircleCI!
Details
ci/circleci: node12-functional Your tests passed on CircleCI!
Details
ci/circleci: node12-integration Your tests passed on CircleCI!
Details
ci/circleci: node12-unit Your tests passed on CircleCI!
Details

@ArkEcosystemBot ArkEcosystemBot deleted the fix-snapshot-rounds-dup branch Jun 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.