Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[NC-2207] Integrate rocksdb-based queue into WorldStateDownloader #746

Merged
merged 11 commits into from
Feb 5, 2019

Conversation

mbaxter
Copy link
Contributor

@mbaxter mbaxter commented Feb 1, 2019

PR description

Integrate rocksdb-based queue into WorldStateDownloader.

@mbaxter mbaxter requested a review from ajsutton February 1, 2019 21:41
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

Just minor details but LGTM.

File queueDataFile = queueDataDirectory.toFile();
queueDataFile.mkdirs();
// Clean up this data for now (until fast sync resume functionality is in place)
queueDataFile.deleteOnExit();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think deleteOnExit will work for a directory that we'll wind up creating files inside. The naming of queueDataDirectory and queueDataFile is a bit misleading here as well since they're both actually a directory just of type Path or File. Not quite sure what the right naming is but I think I'd have queueDataDirectory and queueDataDir since they're the same thing in slightly different forms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right - this won't clean up non-empty directories. I'm still testing this locally, so I'll clean it up a bit and ping you when its ready to look at.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a shutdown hook for the cleanup: bf2306f

@mbaxter mbaxter added the WIP work in progress label Feb 4, 2019
@mbaxter mbaxter removed the WIP work in progress label Feb 4, 2019
LOG.error("Unable to clean up fast sync files: {}", stateQueueDirectory, e);
}
}));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would probably be better to put this in a stop() method which is called from Runner.close. Pantheon already sets up a shutdown hook to call Runner.close and then when tests shutdown Runner without killing the whole JVM this clean up will run then and not be delayed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I can't see where the Queue gets closed. It didn't matter with the in memory implementation but we do need to ensure that rocksdb is closed. This may be a good place (though we'd need to ensure WorldStateDownloader is stopped and not going to try to access the queue anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good feedback! Pushed the cleanup into a stop() method here: f3d4e81

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, that all LGTM. Merge away. :)

@mbaxter mbaxter merged commit 7e25096 into PegaSysEng:master Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants