Skip to content

Commit d4ce794

Browse files
craig[bot]nvanbenschoten
craig[bot]
andcommitted
Merge #44473
44473: storage/engine: expose FailOnMoreRecent MVCC{Get/Scan}Option r=nvanbenschoten a=nvanbenschoten Relates to #40205. This change introduces a new option to `MVCCGetOptions` and `MVCCScanOptions` that causes reads to throw an error if they observe an MVCC version at a timestamp above their read timestamp. Specifically, when the option is enabled, a `WriteTooOldError` will be returned if a scan observes an MVCC version with a timestamp above the read. Similarly, a `WriteIntentError` will be returned if a scan observes another transaction's intent, even if that intent has a timestamp above the scan's read timestamp. This option will be used in the future by `ScanRequests` and `ReverseScanRequests` that intend to acquire unreplicated key-level locks, which will power `SELECT FOR UPDATE`. These scans do not want to ignore existing MVCC versions at higher timestamps like traditional scans do. Instead, they want to throw errors and force their transaction to increase its timestamp through either a refresh or a retry. This was previously prototyped in 4a8e8dc. Interestingly, this is not new logic to the MVCC layer. This behavior is exactly the same as that of the initial key-value lookup performed during MVCC writes (see `mvccPutInternal`). It's fitting that behavior needed for `SELECT FOR UPDATE` would mirror that already exhibited by the read portion of read-write operations. This also hints at an opportunity to potentially use this option to merge the two implementations and get rid of custom logic like `mvccGetInternal` that only exists on the write path. We'd need to be careful about doing so though, as this code is heavily tuned. Release note: None Co-authored-by: Nathan VanBenschoten <[email protected]>
2 parents e45e0d0 + 7759868 commit d4ce794

28 files changed

+606
-266
lines changed

c-deps/libroach/batch.cc

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -587,14 +587,25 @@ DBStatus DBBatch::EnvDeleteDirAndFiles(DBSlice dir) { return FmtStatus("unsuppor
587587

588588
DBStatus DBBatch::EnvLinkFile(DBSlice oldname, DBSlice newname) { return FmtStatus("unsupported"); }
589589

590-
DBStatus DBBatch::EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) { return FmtStatus("unsupported"); }
591-
DBStatus DBBatch::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n) { return FmtStatus("unsupported"); }
592-
DBStatus DBBatch::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) { return FmtStatus("unsupported"); }
593-
DBStatus DBBatch::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) { return FmtStatus("unsupported"); }
590+
DBStatus DBBatch::EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) {
591+
return FmtStatus("unsupported");
592+
}
593+
DBStatus DBBatch::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
594+
int* n) {
595+
return FmtStatus("unsupported");
596+
}
597+
DBStatus DBBatch::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) {
598+
return FmtStatus("unsupported");
599+
}
600+
DBStatus DBBatch::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) {
601+
return FmtStatus("unsupported");
602+
}
594603
DBStatus DBBatch::EnvSyncDirectory(rocksdb::Directory* file) { return FmtStatus("unsupported"); }
595604
DBStatus DBBatch::EnvCloseDirectory(rocksdb::Directory* file) { return FmtStatus("unsupported"); }
596-
DBStatus DBBatch::EnvRenameFile(DBSlice oldname, DBSlice newname) { return FmtStatus("unsupported"); }
597-
605+
DBStatus DBBatch::EnvRenameFile(DBSlice oldname, DBSlice newname) {
606+
return FmtStatus("unsupported");
607+
}
608+
598609
DBWriteOnlyBatch::DBWriteOnlyBatch(DBEngine* db) : DBEngine(db->rep, db->iters), updates(0) {}
599610

600611
DBWriteOnlyBatch::~DBWriteOnlyBatch() {}
@@ -706,13 +717,28 @@ DBStatus DBWriteOnlyBatch::EnvLinkFile(DBSlice oldname, DBSlice newname) {
706717
return FmtStatus("unsupported");
707718
}
708719

709-
DBStatus DBWriteOnlyBatch::EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) { return FmtStatus("unsupported"); }
710-
DBStatus DBWriteOnlyBatch::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n) { return FmtStatus("unsupported"); }
711-
DBStatus DBWriteOnlyBatch::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) { return FmtStatus("unsupported"); }
712-
DBStatus DBWriteOnlyBatch::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) { return FmtStatus("unsupported"); }
713-
DBStatus DBWriteOnlyBatch::EnvSyncDirectory(rocksdb::Directory* file) { return FmtStatus("unsupported"); }
714-
DBStatus DBWriteOnlyBatch::EnvCloseDirectory(rocksdb::Directory* file) { return FmtStatus("unsupported"); }
715-
DBStatus DBWriteOnlyBatch::EnvRenameFile(DBSlice oldname, DBSlice newname) { return FmtStatus("unsupported"); }
720+
DBStatus DBWriteOnlyBatch::EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) {
721+
return FmtStatus("unsupported");
722+
}
723+
DBStatus DBWriteOnlyBatch::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer,
724+
int64_t offset, int* n) {
725+
return FmtStatus("unsupported");
726+
}
727+
DBStatus DBWriteOnlyBatch::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) {
728+
return FmtStatus("unsupported");
729+
}
730+
DBStatus DBWriteOnlyBatch::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) {
731+
return FmtStatus("unsupported");
732+
}
733+
DBStatus DBWriteOnlyBatch::EnvSyncDirectory(rocksdb::Directory* file) {
734+
return FmtStatus("unsupported");
735+
}
736+
DBStatus DBWriteOnlyBatch::EnvCloseDirectory(rocksdb::Directory* file) {
737+
return FmtStatus("unsupported");
738+
}
739+
DBStatus DBWriteOnlyBatch::EnvRenameFile(DBSlice oldname, DBSlice newname) {
740+
return FmtStatus("unsupported");
741+
}
716742

717743
rocksdb::WriteBatch::Handler* GetDBBatchInserter(::rocksdb::WriteBatchBase* batch) {
718744
return new DBBatchInserter(batch);

c-deps/libroach/batch.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct DBBatch : public DBEngine {
5050
virtual DBStatus EnvDeleteDirAndFiles(DBSlice dir);
5151
virtual DBStatus EnvLinkFile(DBSlice oldname, DBSlice newname);
5252
virtual DBStatus EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file);
53-
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n);
53+
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
54+
int* n);
5455
virtual DBStatus EnvCloseReadableFile(rocksdb::RandomAccessFile* file);
5556
virtual DBStatus EnvOpenDirectory(DBSlice path, rocksdb::Directory** file);
5657
virtual DBStatus EnvSyncDirectory(rocksdb::Directory* file);
@@ -90,7 +91,8 @@ struct DBWriteOnlyBatch : public DBEngine {
9091
virtual DBStatus EnvDeleteDirAndFiles(DBSlice dir);
9192
virtual DBStatus EnvLinkFile(DBSlice oldname, DBSlice newname);
9293
virtual DBStatus EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file);
93-
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n);
94+
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
95+
int* n);
9496
virtual DBStatus EnvCloseReadableFile(rocksdb::RandomAccessFile* file);
9597
virtual DBStatus EnvOpenDirectory(DBSlice path, rocksdb::Directory** file);
9698
virtual DBStatus EnvSyncDirectory(rocksdb::Directory* file);

c-deps/libroach/ccl/db_test.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ TEST_F(CCLTest, ReadOnly) {
167167
free(ro_value.data);
168168
// Try to write it again.
169169
auto ret = DBPut(db, ToDBKey("foo"), ToDBSlice("foo's value"));
170-
EXPECT_EQ(ToString(ret),
171-
"Not implemented: Not supported operation in read only mode.");
170+
EXPECT_EQ(ToString(ret), "Not implemented: Not supported operation in read only mode.");
172171
free(ret.data);
173172

174173
DBClose(db);
@@ -192,8 +191,7 @@ TEST_F(CCLTest, ReadOnly) {
192191
free(ro_value.data);
193192
// Try to write it again.
194193
auto ret = DBPut(db, ToDBKey("foo"), ToDBSlice("foo's value"));
195-
EXPECT_EQ(ToString(ret),
196-
"Not implemented: Not supported operation in read only mode.");
194+
EXPECT_EQ(ToString(ret), "Not implemented: Not supported operation in read only mode.");
197195
free(ret.data);
198196

199197
DBClose(db);

c-deps/libroach/chunked_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void chunkedBuffer::put(const char* data, int len, int next_size_hint) {
5959
data += avail;
6060
len -= avail;
6161

62-
const int max_size = 128 << 20; // 128 MB
62+
const int max_size = 128 << 20; // 128 MB
6363
size_t new_size = bufs_.empty() ? 16 : bufs_.back().len * 2;
6464
for (; new_size < len + next_size_hint && new_size < max_size; new_size *= 2) {
6565
}

c-deps/libroach/chunked_buffer_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// writing in pieces that are smaller than the maximum chunk size (128
1616
// MB). See #32896.
1717
TEST(ChunkedBuffer, PutSmall) {
18-
const std::string data(1 << 20, '.'); // 1 MB
19-
const int64_t total = 3LL << 30; // 3 GB
18+
const std::string data(1 << 20, '.'); // 1 MB
19+
const int64_t total = 3LL << 30; // 3 GB
2020
cockroach::chunkedBuffer buf;
2121
for (int64_t sum = 0; sum < total; sum += data.size()) {
2222
buf.Put(data, data);
@@ -27,8 +27,8 @@ TEST(ChunkedBuffer, PutSmall) {
2727
// writing in pieces that are larger than the maximum chunk size (128
2828
// MB). See #32896.
2929
TEST(ChunkedBuffer, PutLarge) {
30-
const std::string data(256 << 20, '.'); // 256 MB
31-
const int64_t total = 3LL << 30; // 3 GB
30+
const std::string data(256 << 20, '.'); // 256 MB
31+
const int64_t total = 3LL << 30; // 3 GB
3232
cockroach::chunkedBuffer buf;
3333
for (int64_t sum = 0; sum < total; sum += data.size()) {
3434
buf.Put(data, data);

c-deps/libroach/comparator.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ bool DBComparator::Equal(const rocksdb::Slice& a, const rocksdb::Slice& b) const
4141

4242
namespace {
4343

44-
void ShrinkSlice(rocksdb::Slice* a, size_t size) {
45-
a->remove_suffix(a->size() - size);
46-
}
44+
void ShrinkSlice(rocksdb::Slice* a, size_t size) { a->remove_suffix(a->size() - size); }
4745

4846
int SharedPrefixLen(const rocksdb::Slice& a, const rocksdb::Slice& b) {
4947
auto n = std::min(a.size(), b.size());
5048
int i = 0;
51-
for (; i < n && a[i] == b[i]; ++i) {}
49+
for (; i < n && a[i] == b[i]; ++i) {
50+
}
5251
return i;
5352
}
5453

@@ -68,7 +67,8 @@ bool FindSeparator(rocksdb::Slice* a, std::string* a_backing, const rocksdb::Sli
6867
// So b is smaller than a.
6968
return false;
7069
}
71-
if ((prefix < b.size() - 1) || static_cast<unsigned char>((*a)[prefix]) + 1 < static_cast<unsigned char>(b[prefix])) {
70+
if ((prefix < b.size() - 1) ||
71+
static_cast<unsigned char>((*a)[prefix]) + 1 < static_cast<unsigned char>(b[prefix])) {
7272
// a and b do not have consecutive characters at prefix.
7373
(*a_backing)[prefix]++;
7474
ShrinkSlice(a, prefix + 1);
@@ -97,7 +97,8 @@ void DBComparator::FindShortestSeparator(std::string* start, const rocksdb::Slic
9797
return;
9898
}
9999
auto found = FindSeparator(&key_s, start, key_l);
100-
if (!found) return;
100+
if (!found)
101+
return;
101102
start->resize(key_s.size() + 1);
102103
(*start)[key_s.size()] = 0x00;
103104
}

c-deps/libroach/comparator_test.cc

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,39 @@ DBKey makeKey(const char* s, int64_t wall_time = 0, int32_t logical = 0) {
4040
TEST(Libroach, Comparator) {
4141
DBComparator comp;
4242
std::vector<SeparatorTestCase> sepCases = {
43-
// Many cases here are adapted from a Pebble unit test.
43+
// Many cases here are adapted from a Pebble unit test.
4444

45-
// Non-empty b values.
46-
{makeKey("black"), makeKey("blue"), makeKey("blb")},
47-
{makeKey(""), makeKey("2"), makeKey("")},
48-
{makeKey("1"), makeKey("2"), makeKey("1")},
49-
{makeKey("1"), makeKey("29"), makeKey("2")},
50-
{makeKey("13"), makeKey("19"), makeKey("14")},
51-
{makeKey("13"), makeKey("99"), makeKey("2")},
52-
{makeKey("135"), makeKey("19"), makeKey("14")},
53-
{makeKey("1357"), makeKey("19"), makeKey("14")},
54-
{makeKey("1357"), makeKey("2"), makeKey("14")},
55-
{makeKey("13\xff"), makeKey("14"), makeKey("13\xff")},
56-
{makeKey("13\xff"), makeKey("19"), makeKey("14")},
57-
{makeKey("1\xff\xff"), makeKey("19"), makeKey("1\xff\xff")},
58-
{makeKey("1\xff\xff"), makeKey("2"), makeKey("1\xff\xff")},
59-
{makeKey("1\xff\xff"), makeKey("9"), makeKey("2")},
60-
{makeKey("1\xfd\xff"), makeKey("1\xff"), makeKey("1\xfe")},
61-
{makeKey("1\xff\xff", 20, 3), makeKey("9"), makeKey("2")},
62-
{makeKey("1\xff\xff", 20, 3), makeKey("19"), makeKey("1\xff\xff", 20, 3)},
45+
// Non-empty b values.
46+
{makeKey("black"), makeKey("blue"), makeKey("blb")},
47+
{makeKey(""), makeKey("2"), makeKey("")},
48+
{makeKey("1"), makeKey("2"), makeKey("1")},
49+
{makeKey("1"), makeKey("29"), makeKey("2")},
50+
{makeKey("13"), makeKey("19"), makeKey("14")},
51+
{makeKey("13"), makeKey("99"), makeKey("2")},
52+
{makeKey("135"), makeKey("19"), makeKey("14")},
53+
{makeKey("1357"), makeKey("19"), makeKey("14")},
54+
{makeKey("1357"), makeKey("2"), makeKey("14")},
55+
{makeKey("13\xff"), makeKey("14"), makeKey("13\xff")},
56+
{makeKey("13\xff"), makeKey("19"), makeKey("14")},
57+
{makeKey("1\xff\xff"), makeKey("19"), makeKey("1\xff\xff")},
58+
{makeKey("1\xff\xff"), makeKey("2"), makeKey("1\xff\xff")},
59+
{makeKey("1\xff\xff"), makeKey("9"), makeKey("2")},
60+
{makeKey("1\xfd\xff"), makeKey("1\xff"), makeKey("1\xfe")},
61+
{makeKey("1\xff\xff", 20, 3), makeKey("9"), makeKey("2")},
62+
{makeKey("1\xff\xff", 20, 3), makeKey("19"), makeKey("1\xff\xff", 20, 3)},
6363

64-
// Empty b values
65-
{makeKey(""), makeKey(""), makeKey("")},
66-
{makeKey("green"), makeKey(""), makeKey("green")},
67-
{makeKey("1"), makeKey(""), makeKey("1")},
68-
{makeKey("11\xff"), makeKey(""), makeKey("11\xff")},
69-
{makeKey("1\xff"), makeKey(""), makeKey("1\xff")},
70-
{makeKey("1\xff\xff"), makeKey(""), makeKey("1\xff\xff")},
71-
{makeKey("\xff"), makeKey(""), makeKey("\xff")},
72-
{makeKey("\xff\xff"), makeKey(""), makeKey("\xff\xff")},
64+
// Empty b values
65+
{makeKey(""), makeKey(""), makeKey("")},
66+
{makeKey("green"), makeKey(""), makeKey("green")},
67+
{makeKey("1"), makeKey(""), makeKey("1")},
68+
{makeKey("11\xff"), makeKey(""), makeKey("11\xff")},
69+
{makeKey("1\xff"), makeKey(""), makeKey("1\xff")},
70+
{makeKey("1\xff\xff"), makeKey(""), makeKey("1\xff\xff")},
71+
{makeKey("\xff"), makeKey(""), makeKey("\xff")},
72+
{makeKey("\xff\xff"), makeKey(""), makeKey("\xff\xff")},
7373
};
74-
75-
for (const auto& c: sepCases) {
74+
75+
for (const auto& c : sepCases) {
7676
auto a_str = EncodeKey(c.a);
7777
auto b_str = EncodeKey(c.b);
7878
std::printf("a_str: %s, b_str: %s\n", a_str.c_str(), b_str.c_str());
@@ -81,21 +81,21 @@ TEST(Libroach, Comparator) {
8181
}
8282

8383
std::vector<SuccessorTestCase> succCases = {
84-
{makeKey("black"), makeKey("c")},
85-
{makeKey("green"), makeKey("h")},
86-
{makeKey(""), makeKey("")},
87-
{makeKey("13"), makeKey("2")},
88-
{makeKey("135"), makeKey("2")},
89-
{makeKey("13\xff"), makeKey("2")},
90-
{makeKey("1\xff\xff", 20, 3), makeKey("2")},
91-
{makeKey("\xff"), makeKey("\xff")},
92-
{makeKey("\xff\xff"), makeKey("\xff\xff")},
93-
{makeKey("\xff\xff\xff"), makeKey("\xff\xff\xff")},
94-
{makeKey("\xfe\xff\xff"), makeKey("\xff")},
95-
{makeKey("\xff\xff", 20, 3), makeKey("\xff\xff", 20, 3)},
84+
{makeKey("black"), makeKey("c")},
85+
{makeKey("green"), makeKey("h")},
86+
{makeKey(""), makeKey("")},
87+
{makeKey("13"), makeKey("2")},
88+
{makeKey("135"), makeKey("2")},
89+
{makeKey("13\xff"), makeKey("2")},
90+
{makeKey("1\xff\xff", 20, 3), makeKey("2")},
91+
{makeKey("\xff"), makeKey("\xff")},
92+
{makeKey("\xff\xff"), makeKey("\xff\xff")},
93+
{makeKey("\xff\xff\xff"), makeKey("\xff\xff\xff")},
94+
{makeKey("\xfe\xff\xff"), makeKey("\xff")},
95+
{makeKey("\xff\xff", 20, 3), makeKey("\xff\xff", 20, 3)},
9696
};
9797

98-
for (const auto& c: succCases) {
98+
for (const auto& c : succCases) {
9999
auto a_str = EncodeKey(c.a);
100100
std::printf("a_str: %s\n", a_str.c_str());
101101
comp.FindShortSuccessor(&a_str);

c-deps/libroach/db.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ DBSstFileWriter* DBSstFileWriterNew() {
940940
// This makes the sstables produced by Pebble and RocksDB byte-by-byte identical, which is
941941
// useful for testing.
942942
table_options.index_shortening =
943-
rocksdb::BlockBasedTableOptions::IndexShorteningMode::kShortenSeparatorsAndSuccessor;
943+
rocksdb::BlockBasedTableOptions::IndexShorteningMode::kShortenSeparatorsAndSuccessor;
944944

945945
rocksdb::Options* options = new rocksdb::Options();
946946
options->comparator = &kComparator;
@@ -1102,7 +1102,7 @@ DBStatus DBExportToSst(DBKey start, DBKey end, bool export_all_revisions,
11021102
std::string resume_key;
11031103
// Seek to the MVCC metadata key for the provided start key and let the
11041104
// incremental iterator find the appropriate version.
1105-
const DBKey seek_key = { .key = start.key };
1105+
const DBKey seek_key = {.key = start.key};
11061106
for (state = iter.seek(seek_key);; state = iter.next(skip_current_key_versions)) {
11071107
if (state.status.data != NULL) {
11081108
DBSstFileWriterClose(writer);
@@ -1129,7 +1129,8 @@ DBStatus DBExportToSst(DBKey start, DBKey end, bool export_all_revisions,
11291129

11301130
// Skip tombstone (len=0) records when start time is zero (non-incremental)
11311131
// and we are not exporting all versions.
1132-
const bool is_skipping_deletes = start.wall_time == 0 && start.logical == 0 && !export_all_revisions;
1132+
const bool is_skipping_deletes =
1133+
start.wall_time == 0 && start.logical == 0 && !export_all_revisions;
11331134
if (is_skipping_deletes && iter.value().size() == 0) {
11341135
continue;
11351136
}
@@ -1183,7 +1184,8 @@ DBStatus DBEnvOpenReadableFile(DBEngine* db, DBSlice path, DBReadableFile* file)
11831184
return db->EnvOpenReadableFile(path, (rocksdb::RandomAccessFile**)file);
11841185
}
11851186

1186-
DBStatus DBEnvReadAtFile(DBEngine* db, DBReadableFile file, DBSlice buffer, int64_t offset, int* n) {
1187+
DBStatus DBEnvReadAtFile(DBEngine* db, DBReadableFile file, DBSlice buffer, int64_t offset,
1188+
int* n) {
11871189
return db->EnvReadAtFile((rocksdb::RandomAccessFile*)file, buffer, offset, n);
11881190
}
11891191

c-deps/libroach/engine.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ DBStatus DBImpl::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) {
467467
return kSuccess;
468468
}
469469

470-
DBStatus DBImpl::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n) {
470+
DBStatus DBImpl::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
471+
int* n) {
471472
size_t max_bytes_to_read = buffer.len;
472473
char* scratch = buffer.data;
473474
rocksdb::Slice result;
@@ -488,9 +489,7 @@ DBStatus DBImpl::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) {
488489
return kSuccess;
489490
}
490491

491-
DBStatus DBImpl::EnvSyncDirectory(rocksdb::Directory* file) {
492-
return ToDBStatus(file->Fsync());
493-
}
492+
DBStatus DBImpl::EnvSyncDirectory(rocksdb::Directory* file) { return ToDBStatus(file->Fsync()); }
494493

495494
DBStatus DBImpl::EnvCloseDirectory(rocksdb::Directory* file) {
496495
delete file;

c-deps/libroach/engine.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ struct DBEngine {
5151
virtual DBStatus EnvDeleteDirAndFiles(DBSlice dir) = 0;
5252
virtual DBStatus EnvLinkFile(DBSlice oldname, DBSlice newname) = 0;
5353
virtual DBStatus EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) = 0;
54-
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n) = 0;
54+
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
55+
int* n) = 0;
5556
virtual DBStatus EnvCloseReadableFile(rocksdb::RandomAccessFile* file) = 0;
5657
virtual DBStatus EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) = 0;
5758
virtual DBStatus EnvSyncDirectory(rocksdb::Directory* file) = 0;
5859
virtual DBStatus EnvCloseDirectory(rocksdb::Directory* file) = 0;
5960
virtual DBStatus EnvRenameFile(DBSlice oldname, DBSlice newname) = 0;
60-
61+
6162
DBSSTable* GetSSTables(int* n);
6263
DBStatus GetSortedWALFiles(DBWALFile** out_files, int* n);
6364
DBString GetUserProperties();
@@ -107,7 +108,8 @@ struct DBImpl : public DBEngine {
107108
virtual DBStatus EnvDeleteDirAndFiles(DBSlice dir);
108109
virtual DBStatus EnvLinkFile(DBSlice oldname, DBSlice newname);
109110
virtual DBStatus EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file);
110-
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset, int* n);
111+
virtual DBStatus EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
112+
int* n);
111113
virtual DBStatus EnvCloseReadableFile(rocksdb::RandomAccessFile* file);
112114
virtual DBStatus EnvOpenDirectory(DBSlice path, rocksdb::Directory** file);
113115
virtual DBStatus EnvSyncDirectory(rocksdb::Directory* file);

0 commit comments

Comments
 (0)