temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Task Predicate Equivalence Check

Open yycptt opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

  • https://github.com/temporalio/temporal/pull/2988 added Predicate.Equals() which checks if two predicates have the same form and value. Since the check won't try to re-arrange the predicates (especially when and/or/not operations are involved), the result will contains false negatives even if mathematically two predicates are equivalent.

  • At current stage we think ^ check is sufficient as 1. in most cases our predicates are quite simple and should be equal even when form is taken into consideration 2. When false negatives are returned we will simply not merge (attach) two queue slices and there's no cost for correctness and performance. (All it costs is some additional storage costs for storing an additional queue slice scope data, which is negligible)

  • If in the future it turns out that we always have a large number of queue slices, we may want to implement a real equivalence check for predicates so that more queue slices can be merged together.

  • Creating this issue to track that this is something we can improve in the future.

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

yycptt avatar Jun 14 '22 18:06 yycptt