Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retraction of an inexistent value of cardinality/one causes server panic #45

Open
spacegangster opened this issue Oct 18, 2019 · 1 comment

Comments

@spacegangster
Copy link
Contributor

spacegangster commented Oct 18, 2019

If a value isn't there, then retraction and its cardinality is one, then if I retract it – Declarative server panics. Not sure if it's a bug though.

reproduction below

; in core namespace
  (def schema
     :loan/epoch  (merge
                   (of-type :Number)
                   (input-semantics :db.semantics.cardinality/one)
                   (tx-time))})

; connect, submit schema then
  (exec! conn
         (transact db
                   [[:db/retract #uuid "1550c322-9111-44f8-a939-c53cee0d9774"
                     :loan/epoch 4]]))

Panic

 server git:(a1323c6) ✗ RUST_BACKTRACE=1 cargo run                                                                                                                   
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s                      
     Running `target/debug/declarative-server`                                                                                                                         
                                         
                                                                                                                                                                       
2thread 'worker thread 0' panicked at 'Received a retraction of a new key on a CardinalityOne attribute', /Users/spacegangster/clj/declarative-dataflow/src/operators/m
od.rs:76:29  

And I think now I don't understand what does cardinality means in this context.

@spacegangster spacegangster changed the title retraction of a inexistent value of cardinality/one causes server panic retraction of an inexistent value of cardinality/one causes server panic Oct 18, 2019
@comnik
Copy link
Member

comnik commented Oct 18, 2019

Strictly speaking, this is not a bug. But even stricter speaking, the CardinalityOne story is not complete yet. The different cardinality's are actually write semantics to be enforced by 3DF. So CardinalityOne should be read as "last write wins", CardinalityMany means "distinct". As part of comnik/declarative-dataflow@a96eb70, they were actually renamed to reflect this.

Compare-and-swap is another input semantic, that we intend to support.

However right now, the last write wins implementation is a proof-of-concept. If you know, that your inputs will be well-formed (e.g. because Crux is already enforcing the right semantics), you should just use :db.semantics/raw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants