valeriansaliou / sonic

🦔 Fast, lightweight & schema-less search backend. An alternative to Elasticsearch that runs on a few MBs of RAM.
https://crates.io/crates/sonic-server
Mozilla Public License 2.0
20k stars 575 forks source link

When I use FLUSHB command, it returns unexpected count #123

Closed ppshobi closed 5 years ago

ppshobi commented 5 years ago

I am using the PHP client to connect with sonic, and I am trying to flush a bucket like follows

  $this->ingest->connect();
  $this->ingest->flushc($this->collection); // clears the collection so i can have a fresh start
  $this->assertEquals("OK", $this->ingest->push($this->collection, $this->bucket, "123", "hi Shobi how are you?")->getStatus());

  $this->assertEquals(1, $this->ingest->flushb($this->collection, $this->bucket)); //fails

// I expect the count to be 1 because there is only one object in the bucket. But it returns 5  :\

Then I have indexed one more object into the same bucket and, then flushed the bucket and then instead of expected 2 it returns 8.

I suspect there might be something wrong with my code. But can't seem to figure out. Does anyone have any pointers where I might have gone wrong?

https://github.com/ppshobi/psonic/blob/dfa1764b92c51c815d83062c78082b1e2bcc7b6b/tests/Unit/IngestChannelTest.php#L106

ppshobi commented 5 years ago

Travis link, https://travis-ci.com/ppshobi/psonic/jobs/191444218

valeriansaliou commented 5 years ago

How many object words were there in that bucket? Also, are you running Sonic v1.1.9? There were changes related to that in latest version.

valeriansaliou commented 5 years ago

Opened an issue on rust-rocksdb to track this: https://github.com/rust-rocksdb/rust-rocksdb/issues/293

ppshobi commented 5 years ago

How many object words were there in that bucket? Also, are you running Sonic v1.1.9? There were changes related to that in latest version.

In-order to make sure the collection have only one bucket and one object, I flushed the collection initially. So I am strong that the collection has only one bucket. even after using two flushc commands one after another, I still get 5 as the count again. And yes, I am using the sonic docker image 1.1.9

valeriansaliou commented 5 years ago

Docker image 1.1.9 contains Sonic 1.1.8 as there was a build issue; could not build from Sonic latest as it cannot be published on Crates without first updating the RocksDB dependency there too. Wait for 1.1.10 that will come with the correct version, or use Sonic outside of Docker :)

--

Valerian Saliou CTO at Crisp

On 9 Apr 2019, at 4:19 PM, Shobi notifications@github.com wrote:

How many object words were there in that bucket? Also, are you running Sonic v1.1.9? There were changes related to that in latest version.

In-order to make sure the collection have only one bucket, I flushed the collection initially. So I am strong that the collection has only one bucket. even after using two flushc commands one after another, I still get 5 as the count again. And yes, I am using the sonic docker image 1.1.9

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

valeriansaliou commented 5 years ago

Closing this as it should be all right in the real v1.1.9.