Skip to content

Conversation

@fanyon
Copy link

@fanyon fanyon commented Mar 30, 2017

close RocksDB in ListViaMergeSpeedMiniBenchmark && ListViaRangeSpeedMiniBenchmark

Copy link

@shixiaogang shixiaogang left a comment

Choose a reason for hiding this comment

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

@fanyon Thanks a lot for the opened PR. These changes help to enhance the safety of the benchmarks. But besides the RocksDB, some other objects should be closed as well when the program exits. You can take a look at the comments for the details.


final String key = "key";
final String value = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ7890654321";
try {

Choose a reason for hiding this comment

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

I think it's better to use try-with-resources here.

System.out.println("end get - duration: " + ((endGet3 - beginGet3) / 1_000_000) + " ms");
System.out.println("end get - duration: " + ((endGet3 - beginGet3) / 1_000_000) + " ms");
} finally {
rocksDB.close();

Choose a reason for hiding this comment

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

Besides RocksDB, Options andWriteOptions should also be closed here.

Choose a reason for hiding this comment

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

I think it's better to delete the RocksDB's directory here.


final long beginGet = System.nanoTime();

final RocksIterator iterator = rocksDB.newIterator();

Choose a reason for hiding this comment

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

The iterator should be closed once it's not used. So it's better to use try-with-resources here.

System.out.println("end get - duration: " + ((endGet - beginGet) / 1_000_000) + " ms");
System.out.println("end get - duration: " + ((endGet - beginGet) / 1_000_000) + " ms");
} finally {
rocksDB.close();

Choose a reason for hiding this comment

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

As with the problem mentioned above, all RocksDB objects should be closed once they are not used.

@fanyon
Copy link
Author

fanyon commented Apr 1, 2017

Hi @shixiaogang , thank you for your reviews. Close and clean all resources such as temp directories is a good idea, I'll fix them later in this PR

2. remove rocksdb tmp directory
@fanyon
Copy link
Author

fanyon commented Apr 18, 2017

Hi @shixiaogang , as we discussed before, I have closed all resources in latest commit, thank you for your comments.

@StephanEwen
Copy link
Contributor

Thank you for the patch!
Taking this over and merging this...

@asfgit asfgit closed this in ea054a7 Apr 21, 2017
StefanRRichter pushed a commit to StefanRRichter/flink that referenced this pull request Apr 24, 2017
PangZhi pushed a commit to PangZhi/flink that referenced this pull request May 1, 2017
StefanRRichter pushed a commit to StefanRRichter/flink that referenced this pull request May 5, 2017
fanyon pushed a commit to fanyon/flink that referenced this pull request May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants