Mercurial > hg > release > thermostat-2.0
changeset 1595:ac7dfc87dcba
Make DATA_COUNT in storage-profile not exactly the default batch size of cursors.
Reviewed-by: omajid
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-December/012027.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Fri, 05 Dec 2014 15:55:14 +0100 |
parents | 5c308934c4fc |
children | ee7b3867cd0f |
files | storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java Fri Dec 05 14:53:14 2014 +0100 +++ b/storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java Fri Dec 05 15:55:14 2014 +0100 @@ -276,9 +276,11 @@ private void measureQueryDistinctItems(Console console, final int ITERATIONS) { try { - // populate data + // populate data, populate it with more than 100 records which is + // the default cursor batch size so as to test retrieving multiple + // batches too. StatementDescriptor<SimpleData> addDesc = new StatementDescriptor<>(PROFILE_CATEGORY, INSERT_DATA); - final int DATA_COUNT = 100; + final int DATA_COUNT = 155; for (int i = 0; i < DATA_COUNT; i++) { PreparedStatement<SimpleData> statement = storage.prepareStatement(addDesc); statement.setString(0, "FOO"); @@ -295,8 +297,13 @@ for (int i = 0; i < ITERATIONS; i++) { PreparedStatement<SimpleData> statement = storage.prepareStatement(desc); Cursor<SimpleData> results = statement.executeQuery(); + int dataReturned = 0; while (results.hasNext()) { /* discard = */ results.next(); + dataReturned++; + } + if (dataReturned != DATA_COUNT) { + throw new AssertionError("Expected " + DATA_COUNT + " results, but got only " + dataReturned); } } long end = System.nanoTime();