-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: propagate retracts before updates in order to have clean indexes (…
…#193) If an update of a tuple is sent into a join node before a retract of that same tuple, the joiner is effectively using stale information and this can lead to various issues such as NPEs. (See the newly introduced BavetRegressionTest.) To address this, we make three changes to how tuples are propagated: First, the dirty queues (now called propagation queues) order their tuples and make sure that retracts are propagated before updates, and updates before inserts. StaticPropagationQueue handles most nodes, but DynamicPropagationQueue is necessary for GroupNode and IfExistsNode, which need more sophisticated (and slower) reordering behavior. Second, nodes are distributed into layers, each layer has nodes that depend on nodes from previous layers. Propagations happen per layer; all nodes in a layer propagate, and then we move on to the next layer. Within each layer, all nodes first propagate retracts, then all nodes propagate updates, then all nodes propagate inserts. Finally, specialized ForEach nodes are introduced for cases with and without nullity filters. When a nullity filter is used, the ForEach node is now smart enough to trigger an insert only when a predicate matches, and therefore subsequent updates/retracts may avoid propagation altogether. Together, these changes significantly clean up and standardize tuple propagation. Performance drop of at most 15 % was seen. Some cases benefit by as much as 5 %, perhaps due to the elimination of useless join cross-products that no longer result from join updates over tuples that would be later retracted. The average performance drop over all the measured use cases is around 5%. Considering that these changes address an incorrect behavior, the performance impact has to be accepted. All turtle tests pass locally. --------- Co-authored-by: Radovan Synek <radovan.synek@gmail.com>
- Loading branch information
Showing
137 changed files
with
2,195 additions
and
1,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 55 additions & 21 deletions
76
...ams/src/main/java/ai/timefold/solver/constraint/streams/bavet/BavetConstraintSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.