Ah, entities.keySet() is misleading because it contains records that were found
in the cache as well as records loaded from earlier passes in cases where we split our query up to avoid database breaking in() clause sizes. Now we track exactly what we got this time around and report that. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2417 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -269,19 +269,21 @@ public abstract class FindAllQuery<T extends PersistentRecord>
|
||||
new KeySet<T>(_type, keys)));
|
||||
PreparedStatement stmt = _builder.prepare(conn);
|
||||
try {
|
||||
Set<Key<T>> got = new HashSet<Key<T>>();
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
int cnt = 0, dups = 0;
|
||||
while (rs.next()) {
|
||||
T obj = _marsh.createObject(rs);
|
||||
if (entities.put(_marsh.getPrimaryKey(obj), obj) != null) {
|
||||
Key<T> key = _marsh.getPrimaryKey(obj);
|
||||
if (entities.put(key, obj) != null) {
|
||||
dups++;
|
||||
}
|
||||
got.add(key);
|
||||
cnt++;
|
||||
}
|
||||
if (cnt != keys.size()) {
|
||||
log.warning("Row count mismatch in second pass [origQuery=" + origStmt +
|
||||
", wanted=" + keys + ", got=" + entities.keySet() +
|
||||
", dups=" + dups + "]", new Exception());
|
||||
log.warning("Row count mismatch in second pass", "origQuery", origStmt,
|
||||
"wanted", keys, "got", got, "dups", dups, new Exception());
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user