-
Notifications
You must be signed in to change notification settings - Fork 113
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
Enabling JournalPruneDataSource #478
Conversation
…lock printing utility
…for the pruneBlockCount variable
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.
few performance enhancement comments.
this.repository.getBlockStore().saveBlock(genesis, genesis.getCumulativeDifficulty(), true); | ||
LOG.info("Rebuilding genesis block SUCCEEDED."); | ||
} | ||
|
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.
how about extract this code snippet to a mathod?
} else if (ref != null) { | ||
ref.dbRef = false; | ||
} | ||
} | ||
src.putBatch(batchRemove); | ||
src.deleteBatch(batchRemove); |
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.
how many keys need to be removed during the prune? if it's a lot, use parallel-stream to shorten the processing time instead of the for loop?
return; | ||
} | ||
// deletes are delayed | ||
keys.forEach(key -> currentUpdates.deletedKeys.add(new ByteArrayWrapper(key))); |
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.
same here. can we do parallel?
I think the batch sizes are too small to need parallelism here at present. |
|
||
LOG.info("Rebuilding genesis block SUCCEEDED."); | ||
} | ||
|
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.
What if buildGenesis fails? Do we need any log message here?
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.
if there is anything wrong with the genesis file an error message will be printed before recovery is attempted
@@ -76,7 +76,12 @@ protected AionRepositoryImpl(IRepositoryConfig repoConfig) { | |||
// repository singleton instance | |||
private final static AionRepositoryImpl inst = new AionRepositoryImpl( | |||
new RepositoryConfig(new File(config.getBasePath(), config.getDb().getPath()).getAbsolutePath(), | |||
-1, | |||
config.getDb().getPrune() > 0 ? | |||
// if the value is smaller than backward step |
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.
Pruning value should dictate parameters for our sync. So if we set a value of 16
as our pruning parameter, sync should respect that value.
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 interaction between pruning and sync is tuned in #498
"Corrupt world state for genesis block hash: " + genesis.getShortHash() + ", number: " + genesis | ||
.getNumber() + "."); | ||
|
||
buildGenesis(genesis); |
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.
buildGenesis()
seems to be building the genesis state based on the current repository
. It's correct for the latter usage, when the database is empty, but is it still valid here?
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.
it's valid, i.e. it always results in the same state root, because when calling createAccount(Address)
the stateRoot = EMPTY_TRIE_HASH;
, so it does not build on the state root of the tracked repository
Description
Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.
BlockchainDataRecoveryTest.java
JournalPruneDataSource.java
for Trie pruningJournalPruneDataSource.java
data storage and retrieval operationsFixes Issue #298.
Type of change
Insert x into the following checkboxes to confirm (eg. [x]):
Testing
Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.
In addition to the unit tests above:
Verification
Insert x into the following checkboxes to confirm (eg. [x]):