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

Store txns in DB #1735

Merged
merged 11 commits into from Aug 2, 2019
Merged

Store txns in DB #1735

merged 11 commits into from Aug 2, 2019

Conversation

KaustubhShamshery
Copy link
Contributor

@KaustubhShamshery KaustubhShamshery commented Jul 22, 2019

Description

Shard and DS nodes store processed txns in LevelDB

Note: processedTxnTmp stores processed txns, however, these may not be confirmed.

Backward Compatibility

  • This is not a breaking change
  • This is a breaking change

Review Suggestion

Status

Implementation

  • ready for review

Integration Test (Core Team)

  • local machine test
  • small-scale cloud test

@KaustubhShamshery KaustubhShamshery requested review from sandipbhoir and kaikawaliu and removed request for sandipbhoir July 22, 2019 07:26
@KaustubhShamshery KaustubhShamshery self-assigned this Jul 22, 2019
@KaustubhShamshery KaustubhShamshery added the Untested Haven't been tested yet label Jul 22, 2019
@sandipbhoir
Copy link
Contributor

can you verify if the persistence with txBodiesTmp from normal shard node is available in recovered node after recovery?

@codecov-io
Copy link

codecov-io commented Jul 22, 2019

Codecov Report

Merging #1735 into master will decrease coverage by 1.14%.
The diff coverage is 6.66%.

@@            Coverage Diff             @@
##           master    #1735      +/-   ##
==========================================
- Coverage    33.5%   32.36%   -1.15%     
==========================================
  Files         270      270              
  Lines       33140    35055    +1915     
==========================================
+ Hits        11105    11347     +242     
- Misses      22035    23708    +1673
Impacted Files Coverage Δ
src/libPersistence/BlockStorage.h 84.61% <ø> (ø) ⬆️
src/common/Constants.h 100% <ø> (ø) ⬆️
src/libPersistence/BlockStorage.cpp 27.64% <0%> (-0.48%) ⬇️
src/libNode/MicroBlockPreProcessing.cpp 0% <0%> (ø) ⬆️
src/common/Constants.cpp 99.75% <100%> (ø) ⬆️
src/libConsensus/ConsensusCommon.h 16.66% <0%> (-8.34%) ⬇️
tests/POW/test_POW.cpp 84.02% <0%> (-0.19%) ⬇️
src/libServer/LookupServer.cpp 0.08% <0%> (-0.03%) ⬇️
...rc/libDirectoryService/FinalBlockPreProcessing.cpp 0% <0%> (ø) ⬆️
src/libDirectoryService/DSBlockPreProcessing.cpp 0% <0%> (ø) ⬆️
... and 9 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 04b3398...38f7a20. Read the comment docs.

@ansnunez ansnunez added this to PRs in development in Core via automation Jul 23, 2019
constants.xml Outdated
@@ -262,6 +262,7 @@
<ENABLE_REPOPULATE>true</ENABLE_REPOPULATE>
<REPOPULATE_STATE_IN_DS>0</REPOPULATE_STATE_IN_DS>
<REPOPULATE_STATE_PER_N_DS>10</REPOPULATE_STATE_PER_N_DS>
<NUM_STORE_TX_BODIES>5</NUM_STORE_TX_BODIES>
Copy link
Contributor

Choose a reason for hiding this comment

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

Change NUM_STORE_TX_BODIES to STORE_TX_BODIES_BLK_INTERVAL will be more understandable

@KaustubhShamshery KaustubhShamshery added Ready Ready for review and removed Untested Haven't been tested yet labels Jul 29, 2019
RefreshDB(SHARD_STRUCTURE) & RefreshDB(STATE_DELTA) &
RefreshDB(TEMP_STATE) & RefreshDB(DIAGNOSTIC_NODES) &
RefreshDB(DIAGNOSTIC_COINBASE) & RefreshDB(STATE_ROOT) &
RefreshDB(TX_BODY) & RefreshDB(MICROBLOCK) &
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be for TX_BODY_TMP instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thanks

@sandipbhoir
Copy link
Contributor

sandipbhoir commented Jul 30, 2019

what would be the behavior if same processed txns are already commited to txBodies db and after recovery of shard node we have them in both txBodies and txBodyTmp.

@KaustubhShamshery
Copy link
Contributor Author

what would behavior if same processed txns are already commited to txBodies db and after recovery of shard node we have them in both txBodies and txBodyTmp.

They would not affect each other, they are different level DBs.

@sandipbhoir
Copy link
Contributor

what would behavior if same processed txns are already commited to txBodies db and after recovery of shard node we have them in both txBodies and txBodyTmp.

They would not affect each other, they are different level DBs.

Ofcorse, but normally processed txns are removed from Tmp after moving to txBodies. In this case, we have it in both. Just curious if that breaks any logic later. If its ok, then all good.

@KaustubhShamshery
Copy link
Contributor Author

KaustubhShamshery commented Jul 30, 2019

what would behavior if same processed txns are already commited to txBodies db and after recovery of shard node we have them in both txBodies and txBodyTmp.

They would not affect each other, they are different level DBs.

Ofcorse, but normally processed txns are removed from Tmp after moving to txBodies. In this case, we have it in both. Just curious if that breaks any logic later. If its ok, then all good.

That is in case of lookup nodes, both of these were not being used in shard nodes before.

@ansnunez ansnunez moved this from PRs in development to PRs needing review (please help!) in Core Jul 30, 2019
Copy link
Contributor

@kaikawaliu kaikawaliu left a comment

Choose a reason for hiding this comment

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

TxBodyTmp is used for cleaning the transactions processed in the latest DS epoch. It's not used for storage purpose. I suggest making another db instance for this specific usage.

Core automation moved this from PRs needing review to PRs approved - ready to merge! Aug 1, 2019
@@ -641,9 +646,22 @@ void Node::ProcessTransactionWhenShardBackup() {

cv_TxnProcFinished.notify_all();

PutTxnsInTempDataBase(t_processedTransactions);
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to consider the fact that the txns in leveldb for backup may not be confirmed transaction.

@ansnunez ansnunez merged commit dd76c5c into master Aug 2, 2019
Core automation moved this from PRs approved - ready to merge! to PRs done (merged) Aug 2, 2019
@n-hutton n-hutton deleted the feature/normal_node_store_txns branch August 8, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready Ready for review
Projects
Core
  
PRs done (merged)
Development

Successfully merging this pull request may close these issues.

None yet

6 participants