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

FastSync with skipHistory fixes #1060

Merged
merged 8 commits into from
Apr 27, 2018
Merged

FastSync with skipHistory fixes #1060

merged 8 commits into from
Apr 27, 2018

Conversation

zilm13
Copy link
Collaborator

@zilm13 zilm13 commented Apr 25, 2018

@coveralls
Copy link

coveralls commented Apr 25, 2018

Coverage Status

Coverage decreased (-0.3%) to 55.908% when pulling 7618476 on fix/no-fast-headers into f761be5 on develop.

public HeaderStore headerStore() {
DbSource<byte[]> dataSource = keyValueDataSource("headers");

WriteCache.BytesKey<byte[]> cache = new WriteCache.BytesKey<>(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to simplify source pipeline in following way:

xorSource("header")  
                   \
                    cachedSource -> kvSource("headers")
                   /
xorSource("index")

/**
* Dummy serializer (doesn't change anything)
*/
public final static Serializer<byte[], byte[]> DummySerializer = new Serializer<byte[], byte[]>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe IdentitySerializer is better? dummy pretty equals to stub

@@ -874,6 +898,10 @@ private BlockHeader getPivotHeaderByHash(byte[] pivotBlockHash) throws Exception
return null;
}

public boolean isEndedOrNotStarted() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't isInProgress() a better name?

for (int i = 1; i < headerSource.size(); ++i) {
BlockHeader curHeader = headerSource.get(i);
headerStore.saveHeader(curHeader);
headerSource.set(i, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't two sources with same physical source collide here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The same chance that two xor sources in one db will collide. Very small.

* @deprecated
* Remove alone with migration from {@link org.ethereum.manager.WorldManager}
*/
@Deprecated
@Bean
@Lazy
public DataSourceArray<BlockHeader> headerSource() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's get rid of this. It can be created manually to run a migration

* adds additional headerSource to Blockchain
* as Blockstore is incomplete in this mode
*/
private void fastSyncDbJobs() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems WorldManager is not the best place for that code. Let's move it to separate class.

/**
* No change serializer (doesn't change anything)
*/
public final static Serializer<byte[], byte[]> NoChangeSerializer = new Serializer<byte[], byte[]>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

AsIs maybe? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm fine with it

@mkalinin mkalinin merged commit d79e287 into develop Apr 27, 2018
@zilm13 zilm13 deleted the fix/no-fast-headers branch June 4, 2018 15:54
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