Skip to content
Snippets Groups Projects
Commit 1eb6f38a authored by Andy Kruth's avatar Andy Kruth
Browse files

Merge pull request #625 from kruthar/orientdb-scan-fix

Orientdb scan fix
parents 78f78838 1863bafa
No related branches found
No related tags found
No related merge requests found
......@@ -72,5 +72,4 @@ WARNING: Creating a new database will be done safely with multiple threads on a
## Known Issues
* There is a performance issue around the scan operation. This binding uses OIndex.iterateEntriesMajor() which will return unnecessarily large iterators. This has a performance impact as the recordcount goes up. There are ideas in the works to fix it, track it here: [#568](https://github.com/brianfrankcooper/YCSB/issues/568).
* The OIndexCursor used to run the scan operation currently seems to be broken. Because of this, if the startkey and recordcount combination on a particular operation were to cause the iterator to go to the end, a NullPointerException is thrown. With sufficiently high record counts, this does not happen very often, but it could cause false negatives. Track that issue here: https://github.com/orientechnologies/orientdb/issues/5541.
* Iterator methods needed to perform scans are Unsupported in the OrientDB API for remote database connections and so will return NOT_IMPLEMENTED status if attempted.
......@@ -280,19 +280,20 @@ public class OrientDBClient extends DB {
int entrycount = 0;
final OIndexCursor entries = dictionary.getIndex().iterateEntriesMajor(startkey, true, true);
while (entries.hasNext() && entrycount < recordcount) {
final Entry<Object, OIdentifiable> entry = entries.nextEntry();
final ODocument document = entry.getValue().getRecord();
if (fields != null && !fields.isEmpty()) {
while (entries.hasNext() && entrycount < recordcount) {
final OIdentifiable entry = entries.next();
final ODocument document = entry.getRecord();
final HashMap<String, ByteIterator> map =
new HashMap<String, ByteIterator>();
result.add(map);
final HashMap<String, ByteIterator> map = new HashMap<String, ByteIterator>();
result.add(map);
for (String field : fields) {
map.put(field, new StringByteIterator((String) document.field(field)));
}
for (String field : fields) {
map.put(field, new StringByteIterator((String) document.field(field)));
}
entrycount++;
entrycount++;
}
}
return Status.OK;
......
......@@ -224,7 +224,7 @@ public class OrientDBClientTest {
* Track the issue here: https://github.com/orientechnologies/orientdb/issues/5541
* This fix was implemented for orientechnologies:orientdb-client:2.1.8
*/
int testIndex = startIndex + 1; // <-- Remove the +1 when the known issue of broken iterator is fixed.
int testIndex = startIndex;
// Check each vector row to make sure we have the correct fields
for (HashMap<String, ByteIterator> result: resultVector) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment