pmem / kvdk

Key Value Development Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unit test of BatchWriteSorted in tests.cpp

fangneverdown opened this issue · comments

Bug Report

KVDK version master branch cdbd3c6

Reproduce steps

size_t num_threads = 1;
batch_size = 150;

no put before BatchWrite:

auto Put = [&](size_t tid) {
  //      for (size_t i = 0; i < count; i++) {
  //        values[tid][i] = GetRandomString(120);
  //        ASSERT_EQ(
  //            engine->SortedPut(collection_name, elems[tid][i],
  //            values[tid][i]), Status::Ok);
  //      }
};

Expect behavior

pass the test

Current behavior

  for (size_t i = 0; i < count; i++) {
    std::string val_resp;
    if (values[tid][i].empty()) {
      ASSERT_EQ(
          engine->SortedGet(collection_name, elems[tid][i], &val_resp),
          Status::NotFound);
    } else {
      ASSERT_EQ(
          engine->SortedGet(collection_name, elems[tid][i], &val_resp),
          Status::Ok);
      ASSERT_EQ(values[tid][i], val_resp);
    }
  }

fail at :

ASSERT_EQ(engine->SortedGet(collection_name, elems[tid][i], &val_resp),Status::Ok);

output:

/home/fangsl/kvdk/tests/tests.cpp:840: Failure
Expected equality of these values:
engine->SortedGet(collection_name, elems[tid][i], &val_resp)
Which is: 1
Status::Ok
Which is: 0

Thank you for reporting this issue and we will fix it ASAP.