Swoorup / dgraph-rs

A dgraph client driver written in rust ⛺
https://crates.io/crates/dgraph
MIT License
98 stars 10 forks source link

Consecutive queries on a transaction causes StartTs mismatch #14

Closed d0nutptr closed 4 years ago

d0nutptr commented 4 years ago

When using a Txn to perform two queries in a row, dgraph errors out with a message stating StartTs mismatch.

You should be able to get that behavior if you do the following:

let mut txn = client.txn();

// Should work okay!
match txn.query("q(func: uid(0x01)) { uid }".to_string()) {
    Ok(result) => {},
    Err(e) => println!(e)
}

// StartTs mismatch (Err!)
match txn.query("q(func: uid(0x01)) { uid }".to_string()) {
    Ok(result) => {},
    Err(e) => println!(e)
}

Thanks for making this library!

d0nutptr commented 4 years ago

I don't really understand what's happening to cause this, but I've temporarily removed the start_ts check in merge_context in txn.rs and this issue has gone away. Of course, I can't help but think that this is A Really Bad Idea (tm).

ondrowan commented 4 years ago

Thanks for reporting this. I've fixed the issue in version 0.3.1. Could you, please, try if it fixed your problem?

d0nutptr commented 4 years ago

Hey @ondrowan so sorry about this long delay.

It does appear that the issue has been fixed. Unfortunately, the current version of grpc used appears to have some issues around an invalid pointer in a free invocation.

That being said, this particular issue has been solved as far as I'm concerned.