Skip to content

Commit

Permalink
Fix error in rescan/invalidation logic for nested notin.
Browse files Browse the repository at this point in the history
  • Loading branch information
neilconway committed Feb 19, 2014
1 parent eab2166 commit 97f8c41
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Improve error message when <~ applied to a collection type that doesn't
support it (#316)
* Fix rescan logic for Zookeeper-backed collections (#317)
* Fix rescan logic for chained negation operators in a single rule
* Support + operator for concatenating tuples
* More consistent behavior for #==, #eql?, and #hash methods on Bud tuple
objects (TupleStruct)
Expand Down
6 changes: 2 additions & 4 deletions lib/bud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ def prepare_invalidation_scheme
rescan_invalidate_tc(stratum, rescan, invalidate)
end

prune_rescan_invalidate(rescan, invalidate)
# transitive closure
@default_rescan = rescan.to_a
@default_invalidate = invalidate.to_a

Expand All @@ -521,7 +519,7 @@ def prepare_invalidation_scheme
rescan = dflt_rescan.clone
invalidate = dflt_invalidate + [scanner.collection]
rescan_invalidate_tc(stratum, rescan, invalidate)
prune_rescan_invalidate(rescan, invalidate)
prune_rescan_set(rescan)

# Make sure we reset the rescan/invalidate flag for this scanner at
# end-of-tick, but we can remove the scanner from its own
Expand Down Expand Up @@ -594,7 +592,7 @@ def rescan_invalidate_tc(stratum, rescan, invalidate)
end
end

def prune_rescan_invalidate(rescan, invalidate)
def prune_rescan_set(rescan)
rescan.delete_if {|e| e.rescan_at_tick}
end

Expand Down
11 changes: 8 additions & 3 deletions test/tc_notin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ class NotInChain
include Bud

state do
table :t1
table :t2_implicit
scratch :t1
scratch :t2_implicit
table :t2, [:foo2, :bar2]
table :t3, [:foo3, :bar3]
table :t4, [:foo4, :bar4]
table :t5
scratch :t5
end

bloom do
Expand Down Expand Up @@ -410,6 +410,11 @@ def test_chain_notin
n.tick
assert_equal([[4, 9], [12, 9]], n.t1.to_a.sort)
assert_equal([[4, 9], [12, 9]], n.t5.to_a.sort)

n.t3 <+ [[5, 12]]
n.tick
assert_equal([[4, 9]], n.t1.to_a.sort)
assert_equal([[4, 9]], n.t5.to_a.sort)
end

def test_chain_join
Expand Down

0 comments on commit 97f8c41

Please sign in to comment.