google / google/leveldb

Documentation is unclear on if lost writes are always ordered and not random

Open
#894 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

Let's say I do 2 writes and nothing else:

db->Put(leveldb::WriteOptions(), key1, value1);
db->Put(leveldb::WriteOptions(), key2, value2);

Now the database crashes. When I restart, can I assume "key1" exists if "key2" is present?

Basically, are writes ordered?

I assume this is the case since writes are all put sequentially in a log file, but it's possible to imagine an implementation using multiple log files where writes are flushed in parallel.

The documentation vaguely implies this is the case ("a crash of the machine may cause *the last* few updates to be lost"), but it's not exactly clear. Note that this property (ordered writes) are different from the "atomic"/"batch" property.

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.