facebook / facebook/rocksdb

Call to DeleteRange with Invalid argument breaks subsequent call with valid argument

Open
#8,239 8 comments 0 reactions 1 assignee Claimed by @abbccdda View on GitHub
enhancement
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

> Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

### Expected behavior

Attempt to delete a valid key range in the DB. Succeeds, correctly.
Attempt to delete an invalid key range (end before start) Fails, correctly.
(*) Attempt to delete another valid key range in the DB. Should succeed.

### Actual behavior

(*) fails, with ""Invalid argument: end key comes before start key"
See included test method for example (this can be pasted into `db_range_del_test.cc` and run.

### Steps to reproduce the behavior

```
TEST_F(DBRangeDelTest, DBInvalidRangeCascadingProblem) {
DB* db;

Options options;
options.create_if_missing = true;
options.merge_operator = MergeOperators::CreateFromStringId("stringappend");
std::string dbname = test::PerThreadDBPath("db_write_batch_problem");

ASSERT_OK(DestroyDB(dbname, options));
Status s = DB::Open(options, dbname, &db);
ASSERT_OK(s);

WriteOptions write_options;

Status s1 = db->DeleteRange(write_options, nullptr, "Y", "Z");
ASSERT_OK(s1);
Status s2 = db->DeleteRange(write_options, nullptr, "Z", "Y");
ASSERT_TRUE(s2.IsInvalidArgument());
Status s3 = db->DeleteRange(write_options, nullptr, "A", "B");
ASSERT_OK(s3); // This fails, "end key comes before start key" !!
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.