Skip to content

Commit

Permalink
Merge fix-stackoverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp99 committed Jul 30, 2023
2 parents 10f89a4 + b14041a commit 119b79f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1199,13 +1199,15 @@ private DeliveredOrder getOldestNewOrderForDistrict(
final List<NewOrder> matchingNewOrders =
registry
.select(ctx, new NewOrder())
/* TODO this code causes a StackOverflowError for some reason
.matching(
new Registry.Matcher<NewOrder>() {
@Override
public boolean match(NewOrder entity) {
return entity.getNo_w_id() == w_id && entity.getNo_d_id() == d_id;
}
})
*/
.sortedBy(
new Comparator<NewOrder>() {
@Override
Expand All @@ -1214,6 +1216,14 @@ public int compare(final NewOrder a, final NewOrder b) {
}
})
.get();
/* Manually remove non-matching NewOrders, see above... */
final Iterator<NewOrder> it = matchingNewOrders.iterator();
while (it.hasNext()) {
final NewOrder no = it.next();
if (no.getNo_w_id() != w_id || no.getNo_d_id() != d_id) it.remove();
}
logger.debug("matchingNewOrders={}", matchingNewOrders);

/*
* [TPC-C 2.7.4.2 (3) (continued)]
* ... If no matching row is found, then the delivery of an order
Expand Down

0 comments on commit 119b79f

Please sign in to comment.