/Users/deen/code/yugabyte-db/src/yb/rocksdb/db.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under the BSD-style license found in the |
3 | | // LICENSE file in the root directory of this source tree. An additional grant |
4 | | // of patent rights can be found in the PATENTS file in the same directory. |
5 | | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. |
6 | | // Use of this source code is governed by a BSD-style license that can be |
7 | | // found in the LICENSE file. See the AUTHORS file for names of contributors. |
8 | | // |
9 | | // The following only applies to changes made to this file as part of YugaByte development. |
10 | | // |
11 | | // Portions Copyright (c) YugaByte, Inc. |
12 | | // |
13 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
14 | | // in compliance with the License. You may obtain a copy of the License at |
15 | | // |
16 | | // http://www.apache.org/licenses/LICENSE-2.0 |
17 | | // |
18 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
19 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
20 | | // or implied. See the License for the specific language governing permissions and limitations |
21 | | // under the License. |
22 | | // |
23 | | |
24 | | #ifndef YB_ROCKSDB_DB_H |
25 | | #define YB_ROCKSDB_DB_H |
26 | | |
27 | | #include <stdint.h> |
28 | | #include <stdio.h> |
29 | | |
30 | | #include <memory> |
31 | | #include <string> |
32 | | #include <unordered_map> |
33 | | #include <vector> |
34 | | |
35 | | #include "yb/rocksdb/iterator.h" |
36 | | #include "yb/rocksdb/listener.h" |
37 | | #include "yb/rocksdb/metadata.h" |
38 | | #include "yb/rocksdb/options.h" |
39 | | #include "yb/rocksdb/transaction_log.h" |
40 | | #include "yb/rocksdb/types.h" |
41 | | |
42 | | #ifdef _WIN32 |
43 | | // Windows API macro interference |
44 | | #undef DeleteFile |
45 | | #endif |
46 | | |
47 | | |
48 | | namespace rocksdb { |
49 | | |
50 | | struct Options; |
51 | | struct DBOptions; |
52 | | struct ColumnFamilyOptions; |
53 | | struct ReadOptions; |
54 | | struct WriteOptions; |
55 | | struct FlushOptions; |
56 | | struct CompactionOptions; |
57 | | struct CompactRangeOptions; |
58 | | struct TableProperties; |
59 | | struct ExternalSstFileInfo; |
60 | | class WriteBatch; |
61 | | class Env; |
62 | | class EventListener; |
63 | | |
64 | | using std::unique_ptr; |
65 | | |
66 | | extern const char kDefaultColumnFamilyName[]; |
67 | | |
68 | | struct ColumnFamilyDescriptor { |
69 | | std::string name; |
70 | | ColumnFamilyOptions options; |
71 | | ColumnFamilyDescriptor() |
72 | | : name(kDefaultColumnFamilyName), options(ColumnFamilyOptions()) {} |
73 | | ColumnFamilyDescriptor(const std::string& _name, |
74 | | const ColumnFamilyOptions& _options) |
75 | 440k | : name(_name), options(_options) {} |
76 | | }; |
77 | | |
78 | | class ColumnFamilyHandle { |
79 | | public: |
80 | 1.28M | virtual ~ColumnFamilyHandle() {} |
81 | | // Returns the name of the column family associated with the current handle. |
82 | | virtual const std::string& GetName() const = 0; |
83 | | // Returns the ID of the column family associated with the current handle. |
84 | | virtual uint32_t GetID() const = 0; |
85 | | // Fills "*desc" with the up-to-date descriptor of the column family |
86 | | // associated with this handle. Since it fills "*desc" with the up-to-date |
87 | | // information, this call might internally lock and release DB mutex to |
88 | | // access the up-to-date CF options. In addition, all the pointer-typed |
89 | | // options cannot be referenced any longer than the original options exist. |
90 | | // |
91 | | // Note that this function is not supported in RocksDBLite. |
92 | | virtual Status GetDescriptor(ColumnFamilyDescriptor* desc) = 0; |
93 | | }; |
94 | | |
95 | | // A range of keys |
96 | | struct Range { |
97 | | Slice start; // Included in the range |
98 | | Slice limit; // Not included in the range |
99 | | |
100 | 0 | Range() { } |
101 | 14.1k | Range(const Slice& s, const Slice& l) : start(s), limit(l) { } |
102 | | }; |
103 | | |
104 | | YB_DEFINE_ENUM(FlushAbility, (kNoNewData)(kHasNewData)(kAlreadyFlushing)) |
105 | | |
106 | | // A collections of table properties objects, where |
107 | | // key: is the table's file name. |
108 | | // value: the table properties object of the given table. |
109 | | typedef std::unordered_map<std::string, std::shared_ptr<const TableProperties>> |
110 | | TablePropertiesCollection; |
111 | | |
112 | | // A DB is a persistent ordered map from keys to values. |
113 | | // A DB is safe for concurrent access from multiple threads without |
114 | | // any external synchronization. |
115 | | class DB { |
116 | | public: |
117 | | // Open the database with the specified "name". |
118 | | // Stores a pointer to a heap-allocated database in *dbptr and returns |
119 | | // OK on success. |
120 | | // Stores nullptr in *dbptr and returns a non-OK status on error. |
121 | | // Caller should delete *dbptr when it is no longer needed. |
122 | | static Status Open(const Options& options, |
123 | | const std::string& name, |
124 | | DB** dbptr); |
125 | | |
126 | | static yb::Result<std::unique_ptr<DB>> Open(const Options& options, const std::string& name); |
127 | | |
128 | | // Open the database for read only. All DB interfaces |
129 | | // that modify data, like put/delete, will return error. |
130 | | // If the db is opened in read only mode, then no compactions |
131 | | // will happen. |
132 | | // |
133 | | // Not supported in ROCKSDB_LITE, in which case the function will |
134 | | // return Status::NotSupported. |
135 | | static Status OpenForReadOnly(const Options& options, |
136 | | const std::string& name, DB** dbptr, |
137 | | bool error_if_log_file_exist = false); |
138 | | |
139 | | // Open the database for read only with column families. When opening DB with |
140 | | // read only, you can specify only a subset of column families in the |
141 | | // database that should be opened. However, you always need to specify default |
142 | | // column family. The default column family name is 'default' and it's stored |
143 | | // in rocksdb::kDefaultColumnFamilyName |
144 | | // |
145 | | // Not supported in ROCKSDB_LITE, in which case the function will |
146 | | // return Status::NotSupported. |
147 | | static Status OpenForReadOnly( |
148 | | const DBOptions& db_options, const std::string& name, |
149 | | const std::vector<ColumnFamilyDescriptor>& column_families, |
150 | | std::vector<ColumnFamilyHandle*>* handles, DB** dbptr, |
151 | | bool error_if_log_file_exist = false); |
152 | | |
153 | | // Open DB with column families. |
154 | | // db_options specify database specific options |
155 | | // column_families is the vector of all column families in the database, |
156 | | // containing column family name and options. You need to open ALL column |
157 | | // families in the database. To get the list of column families, you can use |
158 | | // ListColumnFamilies(). Also, you can open only a subset of column families |
159 | | // for read-only access. |
160 | | // The default column family name is 'default' and it's stored |
161 | | // in rocksdb::kDefaultColumnFamilyName. |
162 | | // If everything is OK, handles will on return be the same size |
163 | | // as column_families --- handles[i] will be a handle that you |
164 | | // will use to operate on column family column_family[i] |
165 | | static Status Open(const DBOptions& db_options, const std::string& name, |
166 | | const std::vector<ColumnFamilyDescriptor>& column_families, |
167 | | std::vector<ColumnFamilyHandle*>* handles, DB** dbptr); |
168 | | |
169 | | // ListColumnFamilies will open the DB specified by argument name |
170 | | // and return the list of all column families in that DB |
171 | | // through column_families argument. The ordering of |
172 | | // column families in column_families is unspecified. |
173 | | static Status ListColumnFamilies(const DBOptions& db_options, |
174 | | const std::string& name, |
175 | | std::vector<std::string>* column_families); |
176 | | |
177 | 435k | DB() { } |
178 | | virtual ~DB(); |
179 | | |
180 | | // Create a column_family and return the handle of column family |
181 | | // through the argument handle. |
182 | | virtual Status CreateColumnFamily(const ColumnFamilyOptions& options, |
183 | | const std::string& column_family_name, |
184 | | ColumnFamilyHandle** handle); |
185 | | |
186 | | // Drop a column family specified by column_family handle. This call |
187 | | // only records a drop record in the manifest and prevents the column |
188 | | // family from flushing and compacting. |
189 | | virtual Status DropColumnFamily(ColumnFamilyHandle* column_family); |
190 | | |
191 | | // Set the database entry for "key" to "value". |
192 | | // If "key" already exists, it will be overwritten. |
193 | | // Returns OK on success, and a non-OK status on error. |
194 | | // Note: consider setting options.sync = true. |
195 | | virtual Status Put(const WriteOptions& options, |
196 | | ColumnFamilyHandle* column_family, const Slice& key, |
197 | | const Slice& value) = 0; |
198 | | virtual Status Put(const WriteOptions& options, const Slice& key, |
199 | 5.50M | const Slice& value) { |
200 | 5.50M | return Put(options, DefaultColumnFamily(), key, value); |
201 | 5.50M | } |
202 | | |
203 | | // Remove the database entry (if any) for "key". Returns OK on |
204 | | // success, and a non-OK status on error. It is not an error if "key" |
205 | | // did not exist in the database. |
206 | | // Note: consider setting options.sync = true. |
207 | | virtual Status Delete(const WriteOptions& options, |
208 | | ColumnFamilyHandle* column_family, |
209 | | const Slice& key) = 0; |
210 | 668k | virtual Status Delete(const WriteOptions& options, const Slice& key) { |
211 | 668k | return Delete(options, DefaultColumnFamily(), key); |
212 | 668k | } |
213 | | |
214 | | // Remove the database entry for "key". Requires that the key exists |
215 | | // and was not overwritten. Returns OK on success, and a non-OK status |
216 | | // on error. It is not an error if "key" did not exist in the database. |
217 | | // |
218 | | // If a key is overwritten (by calling Put() multiple times), then the result |
219 | | // of calling SingleDelete() on this key is undefined. SingleDelete() only |
220 | | // behaves correctly if there has been only one Put() for this key since the |
221 | | // previous call to SingleDelete() for this key. |
222 | | // |
223 | | // This feature is currently an experimental performance optimization |
224 | | // for a very specific workload. It is up to the caller to ensure that |
225 | | // SingleDelete is only used for a key that is not deleted using Delete() or |
226 | | // written using Merge(). Mixing SingleDelete operations with Deletes and |
227 | | // Merges can result in undefined behavior. |
228 | | // |
229 | | // Note: consider setting options.sync = true. |
230 | | virtual Status SingleDelete(const WriteOptions& options, |
231 | | ColumnFamilyHandle* column_family, |
232 | | const Slice& key) = 0; |
233 | 3 | virtual Status SingleDelete(const WriteOptions& options, const Slice& key) { |
234 | 3 | return SingleDelete(options, DefaultColumnFamily(), key); |
235 | 3 | } |
236 | | |
237 | | // Merge the database entry for "key" with "value". Returns OK on success, |
238 | | // and a non-OK status on error. The semantics of this operation is |
239 | | // determined by the user provided merge_operator when opening DB. |
240 | | // Note: consider setting options.sync = true. |
241 | | virtual Status Merge(const WriteOptions& options, |
242 | | ColumnFamilyHandle* column_family, const Slice& key, |
243 | | const Slice& value) = 0; |
244 | | virtual Status Merge(const WriteOptions& options, const Slice& key, |
245 | 90.3k | const Slice& value) { |
246 | 90.3k | return Merge(options, DefaultColumnFamily(), key, value); |
247 | 90.3k | } |
248 | | |
249 | | // Apply the specified updates to the database. |
250 | | // If `updates` contains no update, WAL will still be synced if |
251 | | // options.sync=true. |
252 | | // Returns OK on success, non-OK on failure. |
253 | | // Note: consider setting options.sync = true. |
254 | | virtual Status Write(const WriteOptions& options, WriteBatch* updates) = 0; |
255 | | |
256 | | // If the database contains an entry for "key" store the |
257 | | // corresponding value in *value and return OK. |
258 | | // |
259 | | // If there is no entry for "key" leave *value unchanged and return |
260 | | // a status for which Status::IsNotFound() returns true. |
261 | | // |
262 | | // May return some other Status on an error. |
263 | | virtual Status Get(const ReadOptions& options, |
264 | | ColumnFamilyHandle* column_family, const Slice& key, |
265 | | std::string* value) = 0; |
266 | 4.87M | virtual Status Get(const ReadOptions& options, const Slice& key, std::string* value) { |
267 | 4.87M | return Get(options, DefaultColumnFamily(), key, value); |
268 | 4.87M | } |
269 | | |
270 | | // If keys[i] does not exist in the database, then the i'th returned |
271 | | // status will be one for which Status::IsNotFound() is true, and |
272 | | // (*values)[i] will be set to some arbitrary value (often ""). Otherwise, |
273 | | // the i'th returned status will have Status::ok() true, and (*values)[i] |
274 | | // will store the value associated with keys[i]. |
275 | | // |
276 | | // (*values) will always be resized to be the same size as (keys). |
277 | | // Similarly, the number of returned statuses will be the number of keys. |
278 | | // Note: keys will not be "de-duplicated". Duplicate keys will return |
279 | | // duplicate values in order. |
280 | | virtual std::vector<Status> MultiGet( |
281 | | const ReadOptions& options, |
282 | | const std::vector<ColumnFamilyHandle*>& column_family, |
283 | | const std::vector<Slice>& keys, std::vector<std::string>* values) = 0; |
284 | | virtual std::vector<Status> MultiGet(const ReadOptions& options, |
285 | | const std::vector<Slice>& keys, |
286 | 619 | std::vector<std::string>* values) { |
287 | 619 | return MultiGet(options, std::vector<ColumnFamilyHandle*>( |
288 | 619 | keys.size(), DefaultColumnFamily()), |
289 | 619 | keys, values); |
290 | 619 | } |
291 | | |
292 | | // If the key definitely does not exist in the database, then this method |
293 | | // returns false, else true. If the caller wants to obtain value when the key |
294 | | // is found in memory, a bool for 'value_found' must be passed. 'value_found' |
295 | | // will be true on return if value has been set properly. |
296 | | // This check is potentially lighter-weight than invoking DB::Get(). One way |
297 | | // to make this lighter weight is to avoid doing any IOs. |
298 | | // Default implementation here returns true and sets 'value_found' to false |
299 | | virtual bool KeyMayExist(const ReadOptions& /*options*/, |
300 | | ColumnFamilyHandle* /*column_family*/, |
301 | | const Slice& /*key*/, std::string* /*value*/, |
302 | 0 | bool* value_found = nullptr) { |
303 | 0 | if (value_found != nullptr) { |
304 | 0 | *value_found = false; |
305 | 0 | } |
306 | 0 | return true; |
307 | 0 | } |
308 | | virtual bool KeyMayExist(const ReadOptions& options, const Slice& key, |
309 | 100 | std::string* value, bool* value_found = nullptr) { |
310 | 100 | return KeyMayExist(options, DefaultColumnFamily(), key, value, value_found); |
311 | 100 | } |
312 | | |
313 | | // Return a heap-allocated iterator over the contents of the database. |
314 | | // The result of NewIterator() is initially invalid (caller must |
315 | | // call one of the Seek methods on the iterator before using it). |
316 | | // |
317 | | // Caller should delete the iterator when it is no longer needed. |
318 | | // The returned iterator should be deleted before this db is deleted. |
319 | | virtual Iterator* NewIterator(const ReadOptions& options, |
320 | | ColumnFamilyHandle* column_family) = 0; |
321 | 38.1M | virtual Iterator* NewIterator(const ReadOptions& options) { |
322 | 38.1M | return NewIterator(options, DefaultColumnFamily()); |
323 | 38.1M | } |
324 | | // Returns iterators from a consistent database state across multiple |
325 | | // column families. Iterators are heap allocated and need to be deleted |
326 | | // before the db is deleted |
327 | | virtual Status NewIterators( |
328 | | const ReadOptions& options, |
329 | | const std::vector<ColumnFamilyHandle*>& column_families, |
330 | | std::vector<Iterator*>* iterators) = 0; |
331 | | |
332 | | // Return a handle to the current DB state. Iterators created with |
333 | | // this handle will all observe a stable snapshot of the current DB |
334 | | // state. The caller must call ReleaseSnapshot(result) when the |
335 | | // snapshot is no longer needed. |
336 | | // |
337 | | // nullptr will be returned if the DB fails to take a snapshot or does |
338 | | // not support snapshot. |
339 | | virtual const Snapshot* GetSnapshot() = 0; |
340 | | |
341 | | // Release a previously acquired snapshot. The caller must not |
342 | | // use "snapshot" after this call. |
343 | | virtual void ReleaseSnapshot(const Snapshot* snapshot) = 0; |
344 | | |
345 | | #ifndef ROCKSDB_LITE |
346 | | // Contains all valid property arguments for GetProperty(). |
347 | | // |
348 | | // NOTE: Property names cannot end in numbers since those are interpreted as |
349 | | // arguments, e.g., see kNumFilesAtLevelPrefix. |
350 | | struct Properties { |
351 | | // "rocksdb.num-files-at-level<N>" - returns string containing the number |
352 | | // of files at level <N>, where <N> is an ASCII representation of a |
353 | | // level number (e.g., "0"). |
354 | | static const std::string kNumFilesAtLevelPrefix; |
355 | | |
356 | | // "rocksdb.stats" - returns a multi-line string containing the data |
357 | | // described by kCFStats followed by the data described by kDBStats. |
358 | | static const std::string kStats; |
359 | | |
360 | | // "rocksdb.sstables" - returns a multi-line string summarizing current |
361 | | // SST files. |
362 | | static const std::string kSSTables; |
363 | | |
364 | | // "rocksdb.cfstats" - returns a multi-line string with general column |
365 | | // family stats per-level over db's lifetime ("L<n>"), aggregated over |
366 | | // db's lifetime ("Sum"), and aggregated over the interval since the |
367 | | // last retrieval ("Int"). |
368 | | static const std::string kCFStats; |
369 | | |
370 | | // "rocksdb.dbstats" - returns a multi-line string with general database |
371 | | // stats, both cumulative (over the db's lifetime) and interval (since |
372 | | // the last retrieval of kDBStats). |
373 | | static const std::string kDBStats; |
374 | | |
375 | | // "rocksdb.levelstats" - returns multi-line string containing the number |
376 | | // of files per level and total size of each level (MB). |
377 | | static const std::string kLevelStats; |
378 | | |
379 | | // "rocksdb.num-immutable-mem-table" - returns number of immutable |
380 | | // memtables that have not yet been flushed. |
381 | | static const std::string kNumImmutableMemTable; |
382 | | |
383 | | // "rocksdb.num-immutable-mem-table-flushed" - returns number of immutable |
384 | | // memtables that have already been flushed. |
385 | | static const std::string kNumImmutableMemTableFlushed; |
386 | | |
387 | | // "rocksdb.mem-table-flush-pending" - returns 1 if a memtable flush is |
388 | | // pending; otherwise, returns 0. |
389 | | static const std::string kMemTableFlushPending; |
390 | | |
391 | | // "rocksdb.num-running-flushes" - returns the number of currently running |
392 | | // flushes. |
393 | | static const std::string kNumRunningFlushes; |
394 | | |
395 | | // "rocksdb.compaction-pending" - returns 1 if at least one compaction is |
396 | | // pending; otherwise, returns 0. |
397 | | static const std::string kCompactionPending; |
398 | | |
399 | | // "rocksdb.num-running-compactions" - returns the number of currently |
400 | | // running compactions. |
401 | | static const std::string kNumRunningCompactions; |
402 | | |
403 | | // "rocksdb.background-errors" - returns accumulated number of background |
404 | | // errors. |
405 | | static const std::string kBackgroundErrors; |
406 | | |
407 | | // "rocksdb.cur-size-active-mem-table" - returns approximate size of active |
408 | | // memtable (bytes). |
409 | | static const std::string kCurSizeActiveMemTable; |
410 | | |
411 | | // "rocksdb.cur-size-all-mem-tables" - returns approximate size of active |
412 | | // and unflushed immutable memtables (bytes). |
413 | | static const std::string kCurSizeAllMemTables; |
414 | | |
415 | | // "rocksdb.size-all-mem-tables" - returns approximate size of active, |
416 | | // unflushed immutable, and pinned immutable memtables (bytes). |
417 | | static const std::string kSizeAllMemTables; |
418 | | |
419 | | // "rocksdb.num-entries-active-mem-table" - returns total number of entries |
420 | | // in the active memtable. |
421 | | static const std::string kNumEntriesActiveMemTable; |
422 | | |
423 | | // "rocksdb.num-entries-imm-mem-tables" - returns total number of entries |
424 | | // in the unflushed immutable memtables. |
425 | | static const std::string kNumEntriesImmMemTables; |
426 | | |
427 | | // "rocksdb.num-deletes-active-mem-table" - returns total number of delete |
428 | | // entries in the active memtable. |
429 | | static const std::string kNumDeletesActiveMemTable; |
430 | | |
431 | | // "rocksdb.num-deletes-imm-mem-tables" - returns total number of delete |
432 | | // entries in the unflushed immutable memtables. |
433 | | static const std::string kNumDeletesImmMemTables; |
434 | | |
435 | | // "rocksdb.estimate-num-keys" - returns estimated number of total keys in |
436 | | // the active and unflushed immutable memtables. |
437 | | static const std::string kEstimateNumKeys; |
438 | | |
439 | | // "rocksdb.estimate-table-readers-mem" - returns estimated memory used for |
440 | | // reading SST tables, excluding memory used in block cache (e.g., |
441 | | // filter and index blocks). |
442 | | static const std::string kEstimateTableReadersMem; |
443 | | |
444 | | // "rocksdb.is-file-deletions-enabled" - returns 0 if deletion of obsolete |
445 | | // files is enabled; otherwise, returns a non-zero number. |
446 | | static const std::string kIsFileDeletionsEnabled; |
447 | | |
448 | | // "rocksdb.num-snapshots" - returns number of unreleased snapshots of the |
449 | | // database. |
450 | | static const std::string kNumSnapshots; |
451 | | |
452 | | // "rocksdb.oldest-snapshot-time" - returns number representing unix |
453 | | // timestamp of oldest unreleased snapshot. |
454 | | static const std::string kOldestSnapshotTime; |
455 | | |
456 | | // "rocksdb.num-live-versions" - returns number of live versions. `Version` |
457 | | // is an internal data structure. See version_set.h for details. More |
458 | | // live versions often mean more SST files are held from being deleted, |
459 | | // by iterators or unfinished compactions. |
460 | | static const std::string kNumLiveVersions; |
461 | | |
462 | | // "rocksdb.current-super-version-number" - returns number of curent LSM |
463 | | // version. It is a uint64_t integer number, incremented after there is |
464 | | // any change to the LSM tree. The number is not preserved after restarting |
465 | | // the DB. After DB restart, it will start from 0 again. |
466 | | static const std::string kCurrentSuperVersionNumber; |
467 | | |
468 | | // "rocksdb.estimate-live-data-size" - returns an estimate of the amount of |
469 | | // live data in bytes. |
470 | | static const std::string kEstimateLiveDataSize; |
471 | | |
472 | | // "rocksdb.total-sst-files-size" - returns total size (bytes) of all SST |
473 | | // files. |
474 | | // WARNING: may slow down online queries if there are too many files. |
475 | | static const std::string kTotalSstFilesSize; |
476 | | |
477 | | // "rocksdb.base-level" - returns number of level to which L0 data will be |
478 | | // compacted. |
479 | | static const std::string kBaseLevel; |
480 | | |
481 | | // "rocksdb.estimate-pending-compaction-bytes" - returns estimated total |
482 | | // number of bytes compaction needs to rewrite to get all levels down |
483 | | // to under target size. Not valid for other compactions than level- |
484 | | // based. |
485 | | static const std::string kEstimatePendingCompactionBytes; |
486 | | |
487 | | // "rocksdb.aggregated-table-properties" - returns a string representation |
488 | | // of the aggregated table properties of the target column family. |
489 | | static const std::string kAggregatedTableProperties; |
490 | | |
491 | | // "rocksdb.aggregated-table-properties-at-level<N>", same as the previous |
492 | | // one but only returns the aggregated table properties of the |
493 | | // specified level "N" at the target column family. |
494 | | static const std::string kAggregatedTablePropertiesAtLevel; |
495 | | }; |
496 | | #endif /* ROCKSDB_LITE */ |
497 | | |
498 | | // DB implementations can export properties about their state via this method. |
499 | | // If "property" is a valid property understood by this DB implementation (see |
500 | | // Properties struct above for valid options), fills "*value" with its current |
501 | | // value and returns true. Otherwise, returns false. |
502 | | virtual bool GetProperty(ColumnFamilyHandle* column_family, |
503 | | const Slice& property, std::string* value) = 0; |
504 | 2.70k | virtual bool GetProperty(const Slice& property, std::string* value) { |
505 | 2.70k | return GetProperty(DefaultColumnFamily(), property, value); |
506 | 2.70k | } |
507 | | |
508 | | // Similar to GetProperty(), but only works for a subset of properties whose |
509 | | // return value is an integer. Return the value by integer. Supported |
510 | | // properties: |
511 | | // "rocksdb.num-immutable-mem-table" |
512 | | // "rocksdb.mem-table-flush-pending" |
513 | | // "rocksdb.compaction-pending" |
514 | | // "rocksdb.background-errors" |
515 | | // "rocksdb.cur-size-active-mem-table" |
516 | | // "rocksdb.cur-size-all-mem-tables" |
517 | | // "rocksdb.size-all-mem-tables" |
518 | | // "rocksdb.num-entries-active-mem-table" |
519 | | // "rocksdb.num-entries-imm-mem-tables" |
520 | | // "rocksdb.num-deletes-active-mem-table" |
521 | | // "rocksdb.num-deletes-imm-mem-tables" |
522 | | // "rocksdb.estimate-num-keys" |
523 | | // "rocksdb.estimate-table-readers-mem" |
524 | | // "rocksdb.is-file-deletions-enabled" |
525 | | // "rocksdb.num-snapshots" |
526 | | // "rocksdb.oldest-snapshot-time" |
527 | | // "rocksdb.num-live-versions" |
528 | | // "rocksdb.current-super-version-number" |
529 | | // "rocksdb.estimate-live-data-size" |
530 | | // "rocksdb.total-sst-files-size" |
531 | | // "rocksdb.base-level" |
532 | | // "rocksdb.estimate-pending-compaction-bytes" |
533 | | // "rocksdb.num-running-compactions" |
534 | | // "rocksdb.num-running-flushes" |
535 | | virtual bool GetIntProperty(ColumnFamilyHandle* column_family, |
536 | | const Slice& property, uint64_t* value) = 0; |
537 | 552 | virtual bool GetIntProperty(const Slice& property, uint64_t* value) { |
538 | 552 | return GetIntProperty(DefaultColumnFamily(), property, value); |
539 | 552 | } |
540 | | |
541 | | // Same as GetIntProperty(), but this one returns the aggregated int |
542 | | // property from all column families. |
543 | | virtual bool GetAggregatedIntProperty(const Slice& property, |
544 | | uint64_t* value) = 0; |
545 | | |
546 | | // For each i in [0,n-1], store in "sizes[i]", the approximate |
547 | | // file system space used by keys in "[range[i].start .. range[i].limit)". |
548 | | // |
549 | | // Note that the returned sizes measure file system space usage, so |
550 | | // if the user data compresses by a factor of ten, the returned |
551 | | // sizes will be one-tenth the size of the corresponding user data size. |
552 | | // |
553 | | // If include_memtable is set to true, then the result will also |
554 | | // include those recently written data in the mem-tables if |
555 | | // the mem-table type supports it. |
556 | | virtual void GetApproximateSizes(ColumnFamilyHandle* column_family, |
557 | | const Range* range, int n, uint64_t* sizes, |
558 | | bool include_memtable = false) = 0; |
559 | | virtual void GetApproximateSizes(const Range* range, int n, uint64_t* sizes, |
560 | 66 | bool include_memtable = false) { |
561 | 66 | GetApproximateSizes(DefaultColumnFamily(), range, n, sizes, |
562 | 66 | include_memtable); |
563 | 66 | } |
564 | | |
565 | | // Compact the underlying storage for the key range [*begin,*end]. |
566 | | // The actual compaction interval might be superset of [*begin, *end]. |
567 | | // In particular, deleted and overwritten versions are discarded, |
568 | | // and the data is rearranged to reduce the cost of operations |
569 | | // needed to access the data. This operation should typically only |
570 | | // be invoked by users who understand the underlying implementation. |
571 | | // |
572 | | // begin==nullptr is treated as a key before all keys in the database. |
573 | | // end==nullptr is treated as a key after all keys in the database. |
574 | | // Therefore the following call will compact the entire database: |
575 | | // db->CompactRange(options, nullptr, nullptr); |
576 | | // Note that after the entire database is compacted, all data are pushed |
577 | | // down to the last level containing any data. If the total data size after |
578 | | // compaction is reduced, that level might not be appropriate for hosting all |
579 | | // the files. In this case, client could set options.change_level to true, to |
580 | | // move the files back to the minimum level capable of holding the data set |
581 | | // or a given level (specified by non-negative options.target_level). |
582 | | virtual Status CompactRange(const CompactRangeOptions& options, |
583 | | ColumnFamilyHandle* column_family, |
584 | | const Slice* begin, const Slice* end) = 0; |
585 | | virtual Status CompactRange(const CompactRangeOptions& options, |
586 | 1.49k | const Slice* begin, const Slice* end) { |
587 | 1.49k | return CompactRange(options, DefaultColumnFamily(), begin, end); |
588 | 1.49k | } |
589 | | |
590 | | #if defined(__GNUC__) || defined(__clang__) |
591 | | __attribute__((deprecated)) |
592 | | #elif _WIN32 |
593 | | __declspec(deprecated) |
594 | | #endif |
595 | | virtual Status CompactRange(ColumnFamilyHandle* column_family, const Slice* begin, |
596 | | const Slice* end, bool change_level = false, |
597 | 0 | int target_level = -1, uint32_t target_path_id = 0) { |
598 | 0 | CompactRangeOptions options; |
599 | 0 | options.change_level = change_level; |
600 | 0 | options.target_level = target_level; |
601 | 0 | options.target_path_id = target_path_id; |
602 | 0 | return CompactRange(options, column_family, begin, end); |
603 | 0 | } |
604 | | #if defined(__GNUC__) || defined(__clang__) |
605 | | __attribute__((deprecated)) |
606 | | #elif _WIN32 |
607 | | __declspec(deprecated) |
608 | | #endif |
609 | | virtual Status |
610 | | CompactRange(const Slice* begin, const Slice* end, |
611 | | bool change_level = false, int target_level = -1, |
612 | 0 | uint32_t target_path_id = 0) { |
613 | 0 | CompactRangeOptions options; |
614 | 0 | options.change_level = change_level; |
615 | 0 | options.target_level = target_level; |
616 | 0 | options.target_path_id = target_path_id; |
617 | 0 | return CompactRange(options, DefaultColumnFamily(), begin, end); |
618 | 0 | } |
619 | | |
620 | | virtual Status SetOptions( |
621 | | ColumnFamilyHandle* /*column_family*/, |
622 | | const std::unordered_map<std::string, std::string>& /*new_options*/, |
623 | 0 | bool dump_options = true) { |
624 | 0 | return STATUS(NotSupported, "Not implemented"); |
625 | 0 | } Unexecuted instantiation: rocksdb::DB::SetOptions(rocksdb::ColumnFamilyHandle*, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, bool) Unexecuted instantiation: rocksdb::DB::SetOptions(rocksdb::ColumnFamilyHandle*, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, bool) |
626 | | virtual Status SetOptions( |
627 | 421k | const std::unordered_map<std::string, std::string>& new_options, bool dump_options = true) { |
628 | 421k | return SetOptions(DefaultColumnFamily(), new_options, dump_options); |
629 | 421k | } |
630 | | |
631 | 0 | virtual void SetDisableFlushOnShutdown(bool disable_flush_on_shutdown) {} |
632 | 0 | virtual void StartShutdown() {} |
633 | | |
634 | | // CompactFiles() inputs a list of files specified by file numbers and |
635 | | // compacts them to the specified level. Note that the behavior is different |
636 | | // from CompactRange() in that CompactFiles() performs the compaction job |
637 | | // using the CURRENT thread. |
638 | | // |
639 | | // @see GetDataBaseMetaData |
640 | | // @see GetColumnFamilyMetaData |
641 | | virtual Status CompactFiles( |
642 | | const CompactionOptions& compact_options, |
643 | | ColumnFamilyHandle* column_family, |
644 | | const std::vector<std::string>& input_file_names, |
645 | | const int output_level, const int output_path_id = -1) = 0; |
646 | | |
647 | | virtual Status CompactFiles( |
648 | | const CompactionOptions& compact_options, |
649 | | const std::vector<std::string>& input_file_names, |
650 | 27 | const int output_level, const int output_path_id = -1) { |
651 | 27 | return CompactFiles(compact_options, DefaultColumnFamily(), |
652 | 27 | input_file_names, output_level, output_path_id); |
653 | 27 | } |
654 | | |
655 | | // This function will wait until all currently running background processes |
656 | | // finish. After it returns, no background process will be run until |
657 | | // UnblockBackgroundWork is called |
658 | | virtual Status PauseBackgroundWork() = 0; |
659 | | virtual Status ContinueBackgroundWork() = 0; |
660 | | |
661 | | // This function will enable automatic compactions for the given column |
662 | | // families if they were previously disabled. The function will first set the |
663 | | // disable_auto_compactions option for each column family to 'false', after |
664 | | // which it will schedule a flush/compaction. |
665 | | // |
666 | | // NOTE: Setting disable_auto_compactions to 'false' through SetOptions() API |
667 | | // does NOT schedule a flush/compaction afterwards, and only changes the |
668 | | // parameter itself within the column family option. |
669 | | // |
670 | | virtual Status EnableAutoCompaction( |
671 | | const std::vector<ColumnFamilyHandle*>& column_family_handles) = 0; |
672 | | |
673 | | // Number of levels used for this DB. |
674 | | virtual int NumberLevels(ColumnFamilyHandle* column_family) = 0; |
675 | 725 | virtual int NumberLevels() { return NumberLevels(DefaultColumnFamily()); } |
676 | | |
677 | | // Maximum level to which a new compacted memtable is pushed if it |
678 | | // does not create overlap. |
679 | | virtual int MaxMemCompactionLevel(ColumnFamilyHandle* column_family) = 0; |
680 | 0 | virtual int MaxMemCompactionLevel() { |
681 | 0 | return MaxMemCompactionLevel(DefaultColumnFamily()); |
682 | 0 | } |
683 | | |
684 | | // Number of files in level-0 that would stop writes. |
685 | | virtual int Level0StopWriteTrigger(ColumnFamilyHandle* column_family) = 0; |
686 | 0 | virtual int Level0StopWriteTrigger() { |
687 | 0 | return Level0StopWriteTrigger(DefaultColumnFamily()); |
688 | 0 | } |
689 | | |
690 | | // Get DB name -- the exact same name that was provided as an argument to |
691 | | // DB::Open() |
692 | | virtual const std::string& GetName() const = 0; |
693 | | |
694 | | // Get Env object from the DB |
695 | | virtual Env* GetEnv() const = 0; |
696 | | |
697 | | virtual Env* GetCheckpointEnv() const = 0; |
698 | | |
699 | | // Get DB Options that we use. During the process of opening the |
700 | | // column family, the options provided when calling DB::Open() or |
701 | | // DB::CreateColumnFamily() will have been "sanitized" and transformed |
702 | | // in an implementation-defined manner. |
703 | | virtual const Options& GetOptions(ColumnFamilyHandle* column_family) |
704 | | const = 0; |
705 | 22.6M | virtual const Options& GetOptions() const { |
706 | 22.6M | return GetOptions(DefaultColumnFamily()); |
707 | 22.6M | } |
708 | | |
709 | | virtual const DBOptions& GetDBOptions() const = 0; |
710 | | |
711 | | // Flush all mem-table data. |
712 | | virtual Status Flush(const FlushOptions& options, |
713 | | ColumnFamilyHandle* column_family) = 0; |
714 | 273k | virtual Status Flush(const FlushOptions& options) { |
715 | 273k | return Flush(options, DefaultColumnFamily()); |
716 | 273k | } |
717 | | |
718 | | // Wait for end of mem-table data flushing. |
719 | | virtual Status WaitForFlush(ColumnFamilyHandle* column_family) = 0; |
720 | 174 | virtual Status WaitForFlush() { |
721 | 174 | return WaitForFlush(DefaultColumnFamily()); |
722 | 174 | } |
723 | | |
724 | | // Sync the wal. Note that Write() followed by SyncWAL() is not exactly the |
725 | | // same as Write() with sync=true: in the latter case the changes won't be |
726 | | // visible until the sync is done. |
727 | | // Currently only works if allow_mmap_writes = false in Options. |
728 | | virtual Status SyncWAL() = 0; |
729 | | |
730 | | // The sequence number of the most recent transaction. |
731 | | virtual SequenceNumber GetLatestSequenceNumber() const = 0; |
732 | | |
733 | | #ifndef ROCKSDB_LITE |
734 | | |
735 | | // Prevent file deletions. Compactions will continue to occur, |
736 | | // but no obsolete files will be deleted. Calling this multiple |
737 | | // times have the same effect as calling it once. |
738 | | virtual Status DisableFileDeletions() = 0; |
739 | | |
740 | | // Allow compactions to delete obsolete files. |
741 | | // If force == true, the call to EnableFileDeletions() will guarantee that |
742 | | // file deletions are enabled after the call, even if DisableFileDeletions() |
743 | | // was called multiple times before. |
744 | | // If force == false, EnableFileDeletions will only enable file deletion |
745 | | // after it's been called at least as many times as DisableFileDeletions(), |
746 | | // enabling the two methods to be called by two threads concurrently without |
747 | | // synchronization -- i.e., file deletions will be enabled only after both |
748 | | // threads call EnableFileDeletions() |
749 | | virtual Status EnableFileDeletions(bool force = true) = 0; |
750 | | |
751 | | // GetLiveFiles followed by GetSortedWalFiles can generate a lossless backup |
752 | | |
753 | | // Retrieve the list of all files in the database. The files are |
754 | | // relative to the dbname and are not absolute paths. The valid size of the |
755 | | // manifest file is returned in manifest_file_size. The manifest file is an |
756 | | // ever growing file, but only the portion specified by manifest_file_size is |
757 | | // valid for this snapshot. |
758 | | // Setting flush_memtable to true does Flush before recording the live files. |
759 | | // Setting flush_memtable to false is useful when we don't want to wait for |
760 | | // flush which may have to wait for compaction to complete taking an |
761 | | // indeterminate time. |
762 | | // |
763 | | // In case you have multiple column families, even if flush_memtable is true, |
764 | | // you still need to call GetSortedWalFiles after GetLiveFiles to compensate |
765 | | // for new data that arrived to already-flushed column families while other |
766 | | // column families were flushing |
767 | | virtual Status GetLiveFiles(std::vector<std::string>&, |
768 | | uint64_t* manifest_file_size, |
769 | | bool flush_memtable = true) = 0; |
770 | | |
771 | | // Retrieve the sorted list of all wal files with earliest file first |
772 | | virtual Status GetSortedWalFiles(VectorLogPtr* files) = 0; |
773 | | |
774 | | // Sets iter to an iterator that is positioned at a write-batch containing |
775 | | // seq_number. If the sequence number is non existent, it returns an iterator |
776 | | // at the first available seq_no after the requested seq_no |
777 | | // Returns Status::OK if iterator is valid |
778 | | // Must set WAL_ttl_seconds or WAL_size_limit_MB to large values to |
779 | | // use this api, else the WAL files will get |
780 | | // cleared aggressively and the iterator might keep getting invalid before |
781 | | // an update is read. |
782 | | virtual Status GetUpdatesSince( |
783 | | SequenceNumber seq_number, unique_ptr<TransactionLogIterator>* iter, |
784 | | const TransactionLogIterator::ReadOptions& |
785 | | read_options = TransactionLogIterator::ReadOptions()) = 0; |
786 | | |
787 | | // Windows API macro interference |
788 | | #undef DeleteFile |
789 | | // Delete the file name from the db directory and update the internal state to |
790 | | // reflect that. Supports deletion of sst and log files only. 'name' must be |
791 | | // path relative to the db directory. eg. 000001.sst, /archive/000003.log |
792 | | virtual Status DeleteFile(std::string name) = 0; |
793 | | |
794 | | // Returns the total combined size of all the SST Files for the current version in the rocksdb |
795 | | // instance. |
796 | 0 | virtual uint64_t GetCurrentVersionSstFilesSize() { return 0; } |
797 | 0 | virtual uint64_t GetCurrentVersionSstFilesUncompressedSize() { return 0; } |
798 | 0 | virtual std::pair<uint64_t, uint64_t> GetCurrentVersionSstFilesAllSizes() { |
799 | 0 | return std::pair<uint64_t, uint64_t>(0, 0); |
800 | 0 | } |
801 | | |
802 | | // Returns total number of SST Files. |
803 | 0 | virtual uint64_t GetCurrentVersionNumSSTFiles() { return 0; } |
804 | | |
805 | | // Returns the combined size of all the SST Files data blocks for the current version in the |
806 | | // rocksdb instance. |
807 | 0 | virtual uint64_t GetCurrentVersionDataSstFilesSize() { return 0; } |
808 | | |
809 | | // Returns number of memtables not flushed in default column family memtable list. |
810 | 0 | virtual int GetCfdImmNumNotFlushed() { return 0; } |
811 | | |
812 | | // Returns a list of all table files for the current version with their level, start key and end |
813 | | // key. |
814 | 0 | virtual void GetLiveFilesMetaData(std::vector<LiveFileMetaData>* /*metadata*/) {} |
815 | | |
816 | 6 | std::vector<LiveFileMetaData> GetLiveFilesMetaData() { |
817 | 6 | std::vector<LiveFileMetaData> result; |
818 | 6 | GetLiveFilesMetaData(&result); |
819 | 6 | return result; |
820 | 6 | } |
821 | | |
822 | 0 | virtual UserFrontierPtr GetFlushedFrontier() { return nullptr; } |
823 | | |
824 | | virtual CHECKED_STATUS ModifyFlushedFrontier( |
825 | | UserFrontierPtr values, |
826 | 0 | FrontierModificationMode mode) { |
827 | 0 | return Status::OK(); |
828 | 0 | } |
829 | | |
830 | 0 | virtual FlushAbility GetFlushAbility() { return FlushAbility::kHasNewData; } |
831 | | |
832 | 0 | virtual UserFrontierPtr GetMutableMemTableFrontier(UpdateUserValueType type) { return nullptr; } |
833 | | |
834 | 0 | virtual void ListenFilesChanged(std::function<void()> listener) {} |
835 | | |
836 | | // Obtains the meta data of the specified column family of the DB. |
837 | | // STATUS(NotFound, "") will be returned if the current DB does not have |
838 | | // any column family match the specified name. |
839 | | // |
840 | | // If cf_name is not specified, then the metadata of the default |
841 | | // column family will be returned. |
842 | | virtual void GetColumnFamilyMetaData(ColumnFamilyHandle* /*column_family*/, |
843 | 0 | ColumnFamilyMetaData* /*metadata*/) {} |
844 | | |
845 | | // Get the metadata of the default column family. |
846 | | void GetColumnFamilyMetaData( |
847 | 427 | ColumnFamilyMetaData* metadata) { |
848 | 427 | GetColumnFamilyMetaData(DefaultColumnFamily(), metadata); |
849 | 427 | } |
850 | | |
851 | | // Obtains all column family options and corresponding names, |
852 | | // dropped columns are not included into the resulting collections. |
853 | | virtual void GetColumnFamiliesOptions( |
854 | | std::vector<std::string>* column_family_names, |
855 | | std::vector<ColumnFamilyOptions>* column_family_options) = 0; |
856 | | |
857 | | // Load table file located at "file_path" into "column_family", a pointer to |
858 | | // ExternalSstFileInfo can be used instead of "file_path" to do a blind add |
859 | | // that wont need to read the file, move_file can be set to true to |
860 | | // move the file instead of copying it. |
861 | | // |
862 | | // Current Requirements: |
863 | | // (1) Key range in loaded table file don't overlap with |
864 | | // existing keys or tombstones in DB. |
865 | | // (2) No other writes happen during AddFile call, otherwise |
866 | | // DB may get corrupted. |
867 | | // (3) No snapshots are held. |
868 | | virtual Status AddFile(ColumnFamilyHandle* column_family, |
869 | | const std::string& file_path, |
870 | | bool move_file = false) = 0; |
871 | 570 | virtual Status AddFile(const std::string& file_path, bool move_file = false) { |
872 | 570 | return AddFile(DefaultColumnFamily(), file_path, move_file); |
873 | 570 | } |
874 | | |
875 | | // Load table file with information "file_info" into "column_family" |
876 | | virtual Status AddFile(ColumnFamilyHandle* column_family, |
877 | | const ExternalSstFileInfo* file_info, |
878 | | bool move_file = false) = 0; |
879 | | virtual Status AddFile(const ExternalSstFileInfo* file_info, |
880 | 9.29k | bool move_file = false) { |
881 | 9.29k | return AddFile(DefaultColumnFamily(), file_info, move_file); |
882 | 9.29k | } |
883 | | |
884 | | #endif // ROCKSDB_LITE |
885 | | |
886 | | // Sets the globally unique ID created at database creation time by invoking |
887 | | // Env::GenerateUniqueId(), in identity. Returns Status::OK if identity could |
888 | | // be set properly |
889 | | virtual Status GetDbIdentity(std::string* identity) const = 0; |
890 | | |
891 | | // Returns default column family handle |
892 | | virtual ColumnFamilyHandle* DefaultColumnFamily() const = 0; |
893 | | |
894 | | #ifndef ROCKSDB_LITE |
895 | | virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family, |
896 | | TablePropertiesCollection* props) = 0; |
897 | 54 | virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) { |
898 | 54 | return GetPropertiesOfAllTables(DefaultColumnFamily(), props); |
899 | 54 | } |
900 | | virtual Status GetPropertiesOfTablesInRange( |
901 | | ColumnFamilyHandle* column_family, const Range* range, std::size_t n, |
902 | | TablePropertiesCollection* props) = 0; |
903 | | #endif // ROCKSDB_LITE |
904 | | |
905 | | // Needed for StackableDB |
906 | 55 | virtual DB* GetRootDB() { return this; } |
907 | | |
908 | 0 | virtual CHECKED_STATUS Import(const std::string& source_dir) { |
909 | 0 | return STATUS(NotSupported, ""); |
910 | 0 | } Unexecuted instantiation: rocksdb::DB::Import(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: rocksdb::DB::Import(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) |
911 | | |
912 | 0 | virtual bool NeedsDelay() { return false; } |
913 | | |
914 | | // Returns approximate middle key (see Version::GetMiddleKey). |
915 | | virtual yb::Result<std::string> GetMiddleKey() = 0; |
916 | | |
917 | | // Used in testing to make the old memtable immutable and start writing to a new one. |
918 | 0 | virtual void TEST_SwitchMemtable() {} |
919 | | |
920 | | private: |
921 | | // No copying allowed |
922 | | DB(const DB&); |
923 | | void operator=(const DB&); |
924 | | }; |
925 | | |
926 | | // Destroy the contents of the specified database. |
927 | | // Be very careful using this method. |
928 | | Status DestroyDB(const std::string& name, const Options& options); |
929 | | |
930 | | #ifndef ROCKSDB_LITE |
931 | | // If a DB cannot be opened, you may attempt to call this method to |
932 | | // resurrect as much of the contents of the database as possible. |
933 | | // Some data may be lost, so be careful when calling this function |
934 | | // on a database that contains important information. |
935 | | Status RepairDB(const std::string& dbname, const Options& options); |
936 | | #endif |
937 | | |
938 | | } // namespace rocksdb |
939 | | |
940 | | #endif // YB_ROCKSDB_DB_H |