stephenmcd / curiodb

Distributed NoSQL Database
http://curiodb.jupo.org
BSD 2-Clause "Simplified" License
511 stars 47 forks source link

fix setnx #2

Closed tramchamploo closed 9 years ago

tramchamploo commented 9 years ago

1

stephenmcd commented 9 years ago

Thanks a lot for reporting this and providing a fix! There's actually a bit more to it, and the correct fix is pushed in 5b5d64552d07f94e5aed313f7b87861a8be9a14b

Basically SETNX looks like it always returns true, because it actually only ever runs when the node doesn't exist and gets created - otherwise if the node already exists, the validation logic in KeyNode.validate should detect this, and return a value before the StringNode is even reached - that's where the bug was that I've fixed now.

Thanks again.

tramchamploo commented 9 years ago

Yes I find it too. And create a pull request, I'll close it later