YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/rocksdb/util/env.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
//
14
//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
15
//  This source code is licensed under the BSD-style license found in the
16
//  LICENSE file in the root directory of this source tree. An additional grant
17
//  of patent rights can be found in the PATENTS file in the same directory.
18
//
19
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
20
// Use of this source code is governed by a BSD-style license that can be
21
// found in the LICENSE file. See the AUTHORS file for names of contributors.
22
23
#include "yb/rocksdb/env.h"
24
25
#include <thread>
26
27
#include "yb/rocksdb/options.h"
28
29
#include "yb/util/result.h"
30
#include "yb/util/status_log.h"
31
32
namespace rocksdb {
33
34
2.05k
Env::~Env() {
35
2.05k
}
36
37
0
uint64_t Env::GetThreadID() const {
38
0
  std::hash<std::thread::id> hasher;
39
0
  return hasher(std::this_thread::get_id());
40
0
}
41
42
Status Env::ReuseWritableFile(const std::string& fname,
43
                              const std::string& old_fname,
44
                              unique_ptr<WritableFile>* result,
45
0
                              const EnvOptions& options) {
46
0
  Status s = RenameFile(old_fname, fname);
47
0
  if (!s.ok()) {
48
0
    return s;
49
0
  }
50
0
  return NewWritableFile(fname, result, options);
51
0
}
52
53
Status Env::GetChildrenFileAttributes(const std::string& dir,
54
1
                                      std::vector<FileAttributes>* result) {
55
1
  assert(result != nullptr);
56
1
  std::vector<std::string> child_fnames;
57
1
  Status s = GetChildren(dir, &child_fnames);
58
1
  if (!s.ok()) {
59
0
    return s;
60
0
  }
61
1
  result->resize(child_fnames.size());
62
1
  size_t result_size = 0;
63
13
  for (size_t i = 0; i < child_fnames.size(); ++i) {
64
12
    const std::string path = dir + "/" + child_fnames[i];
65
12
    s = GetFileSize(path, &(*result)[result_size].size_bytes);
66
12
    if (!s.ok()) {
67
0
      if (FileExists(path).IsNotFound()) {
68
        // The file may have been deleted since we listed the directory
69
0
        continue;
70
0
      }
71
0
      return s;
72
0
    }
73
12
    (*result)[result_size].name = std::move(child_fnames[i]);
74
12
    result_size++;
75
12
  }
76
1
  result->resize(result_size);
77
1
  return Status::OK();
78
1
}
79
80
0
yb::Result<uint64_t> Env::GetFileSize(const std::string& fname) {
81
0
  uint64_t result;
82
0
  RETURN_NOT_OK(GetFileSize(fname, &result));
83
0
  return result;
84
0
}
85
86
347k
void Env::CleanupFile(const std::string& fname) {
87
347k
  WARN_NOT_OK(DeleteFile(fname), "Failed to cleanup " + fname);
88
347k
}
89
90
void Env::GetChildrenWarnNotOk(const std::string& dir,
91
1.38M
                               std::vector<std::string>* result) {
92
1.38M
  WARN_NOT_OK(GetChildren(dir, result), "Failed to get children " + dir);
93
1.38M
}
94
95
3.14M
WritableFile::~WritableFile() {
96
3.14M
}
97
98
540k
Logger::~Logger() {
99
540k
}
100
101
669k
FileLock::~FileLock() {
102
669k
}
103
104
2
void LogFlush(Logger *info_log) {
105
2
  if (info_log) {
106
2
    info_log->Flush();
107
2
  }
108
2
}
109
110
void LogWithContext(const char* file,
111
                    const int line,
112
                    Logger* info_log,
113
                    const char* format,
114
147k
                    ...) {
115
147k
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::INFO_LEVEL) {
116
147k
    va_list ap;
117
147k
    va_start(ap, format);
118
147k
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
119
147k
    va_end(ap);
120
147k
  }
121
147k
}
122
123
0
void Logger::Logv(const InfoLogLevel log_level, const char* format, va_list ap) {
124
0
  LogvWithContext(__FILE__, __LINE__, log_level, format, ap);
125
0
}
126
127
void Logger::LogvWithContext(const char* file,
128
    const int line,
129
    const InfoLogLevel log_level,
130
    const char* format,
131
1.97M
    va_list ap) {
132
1.97M
  static const char* kInfoLogLevelNames[6] = {"DEBUG", "INFO", "WARN", "ERROR", "FATAL", "HEADER"};
133
1.97M
  static_assert(
134
1.97M
      sizeof(kInfoLogLevelNames) / sizeof(kInfoLogLevelNames[0]) == NUM_INFO_LOG_LEVELS,
135
1.97M
      "kInfoLogLevelNames must have an element for each log level");
136
1.97M
  if (log_level < log_level_) {
137
0
    return;
138
0
  }
139
140
1.97M
  if (log_level == InfoLogLevel::INFO_LEVEL) {
141
    // Doesn't print log level if it is INFO level.
142
    // This is to avoid unexpected performance regression after we add
143
    // the feature of log level. All the logs before we add the feature
144
    // are INFO level. We don't want to add extra costs to those existing
145
    // logging.
146
604k
    Logv(format, ap);
147
1.36M
  } else {
148
1.36M
    char new_format[500];
149
1.36M
    snprintf(new_format, sizeof(new_format) - 1, "[%s] %s",
150
1.36M
        kInfoLogLevelNames[log_level], format);
151
1.36M
    Logv(new_format, ap);
152
1.36M
  }
153
1.97M
}
154
155
156
void LogWithContext(const char* file,
157
                    const int line,
158
                    const InfoLogLevel log_level,
159
                    Logger* info_log,
160
                    const char* format,
161
628k
                    ...) {
162
628k
  if (info_log && info_log->GetInfoLogLevel() <= log_level) {
163
296k
    va_list ap;
164
296k
    va_start(ap, format);
165
166
296k
    if (log_level == InfoLogLevel::HEADER_LEVEL) {
167
22
      info_log->LogHeaderWithContext(file, line, format, ap);
168
296k
    } else {
169
296k
      info_log->LogvWithContext(file, line, log_level, format, ap);
170
296k
    }
171
172
296k
    va_end(ap);
173
296k
  }
174
628k
}
175
176
void HeaderWithContext(const char* file, const int line,
177
1.13M
    Logger *info_log, const char *format, ...) {
178
1.13M
  if (info_log) {
179
1.13M
    va_list ap;
180
1.13M
    va_start(ap, format);
181
1.13M
    info_log->LogHeaderWithContext(file, line, format, ap);
182
1.13M
    va_end(ap);
183
1.13M
  }
184
1.13M
}
185
186
void DebugWithContext(const char* file, const int line,
187
92.9k
    Logger *info_log, const char *format, ...) {
188
// Log level should be higher than DEBUG, but including the ifndef for compiletime optimization.
189
92.9k
#ifndef NDEBUG
190
92.9k
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::DEBUG_LEVEL) {
191
83.5k
    va_list ap;
192
83.5k
    va_start(ap, format);
193
83.5k
    info_log->LogvWithContext(file, line, InfoLogLevel::DEBUG_LEVEL, format, ap);
194
83.5k
    va_end(ap);
195
83.5k
  }
196
92.9k
#endif
197
92.9k
}
198
199
void InfoWithContext(const char* file, const int line,
200
2.97k
    Logger *info_log, const char *format, ...) {
201
2.97k
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::INFO_LEVEL) {
202
2.96k
    va_list ap;
203
2.96k
    va_start(ap, format);
204
2.96k
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
205
2.96k
    va_end(ap);
206
2.96k
  }
207
2.97k
}
208
209
void WarnWithContext(const char* file, const int line,
210
388
    Logger *info_log, const char *format, ...) {
211
388
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::WARN_LEVEL) {
212
179
    va_list ap;
213
179
    va_start(ap, format);
214
179
    info_log->LogvWithContext(file, line, InfoLogLevel::WARN_LEVEL, format, ap);
215
179
    va_end(ap);
216
179
  }
217
388
}
218
void ErrorWithContext(const char* file, const int line,
219
6
    Logger *info_log, const char *format, ...) {
220
6
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::ERROR_LEVEL) {
221
4
    va_list ap;
222
4
    va_start(ap, format);
223
4
    info_log->LogvWithContext(file, line, InfoLogLevel::ERROR_LEVEL, format, ap);
224
4
    va_end(ap);
225
4
  }
226
6
}
227
void FatalWithContext(const char* file, const int line,
228
6
    Logger *info_log, const char *format, ...) {
229
6
  if (info_log && info_log->GetInfoLogLevel() <= InfoLogLevel::FATAL_LEVEL) {
230
5
    va_list ap;
231
5
    va_start(ap, format);
232
5
    info_log->LogvWithContext(file, line, InfoLogLevel::FATAL_LEVEL, format, ap);
233
5
    va_end(ap);
234
5
  }
235
6
}
236
237
2.74M
void LogFlush(const shared_ptr<Logger>& info_log) {
238
2.74M
  if (info_log) {
239
2.74M
    info_log->Flush();
240
2.74M
  }
241
2.74M
}
242
243
void LogWithContext(const char* file,
244
                    const int line,
245
                    const InfoLogLevel log_level,
246
                    const shared_ptr<Logger>& info_log,
247
                    const char* format,
248
3.94M
                    ...) {
249
3.94M
  if (info_log) {
250
3.94M
    va_list ap;
251
3.94M
    va_start(ap, format);
252
3.94M
    info_log->LogvWithContext(file, line, log_level, format, ap);
253
3.94M
    va_end(ap);
254
3.94M
  }
255
3.94M
}
256
257
void HeaderWithContext(
258
    const char* file,
259
    const int line,
260
    const shared_ptr<Logger> &info_log,
261
0
    const char *format, ...) {
262
0
  if (info_log) {
263
0
    va_list ap;
264
0
    va_start(ap, format);
265
0
    info_log->LogHeaderWithContext(file, line, format, ap);
266
0
    va_end(ap);
267
0
  }
268
0
}
269
270
void DebugWithContext(
271
    const char* file,
272
    const int line,
273
    const shared_ptr<Logger> &info_log,
274
0
    const char *format, ...) {
275
0
  if (info_log) {
276
0
    va_list ap;
277
0
    va_start(ap, format);
278
0
    info_log->LogvWithContext(file, line, InfoLogLevel::DEBUG_LEVEL, format, ap);
279
0
    va_end(ap);
280
0
  }
281
0
}
282
283
void InfoWithContext(
284
    const char* file,
285
    const int line,
286
    const shared_ptr<Logger> &info_log,
287
0
    const char *format, ...) {
288
0
  if (info_log) {
289
0
    va_list ap;
290
0
    va_start(ap, format);
291
0
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
292
0
    va_end(ap);
293
0
  }
294
0
}
295
296
void WarnWithContext(
297
    const char* file,
298
    const int line,
299
    const shared_ptr<Logger> &info_log,
300
56
    const char *format, ...) {
301
56
  if (info_log) {
302
56
    va_list ap;
303
56
    va_start(ap, format);
304
56
    info_log->LogvWithContext(file, line, InfoLogLevel::WARN_LEVEL, format, ap);
305
56
    va_end(ap);
306
56
  }
307
56
}
308
309
void ErrorWithContext(
310
    const char* file,
311
    const int line,
312
    const shared_ptr<Logger> &info_log,
313
0
    const char *format, ...) {
314
0
  if (info_log) {
315
0
    va_list ap;
316
0
    va_start(ap, format);
317
0
    info_log->LogvWithContext(file, line, InfoLogLevel::ERROR_LEVEL, format, ap);
318
0
    va_end(ap);
319
0
  }
320
0
}
321
322
void FatalWithContext(
323
    const char* file,
324
    const int line,
325
    const shared_ptr<Logger> &info_log,
326
0
    const char *format, ...) {
327
0
  if (info_log) {
328
0
    va_list ap;
329
0
    va_start(ap, format);
330
0
    info_log->LogvWithContext(file, line, InfoLogLevel::FATAL_LEVEL, format, ap);
331
0
    va_end(ap);
332
0
  }
333
0
}
334
335
void LogWithContext(const char* file,
336
                    const int line,
337
                    const shared_ptr<Logger>& info_log,
338
                    const char* format,
339
11.9k
                    ...) {
340
11.9k
  if (info_log) {
341
11.9k
    va_list ap;
342
11.9k
    va_start(ap, format);
343
11.9k
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
344
11.9k
    va_end(ap);
345
11.9k
  }
346
11.9k
}
347
348
Status WriteStringToFile(Env* env, const Slice& data, const std::string& fname,
349
923k
                         bool should_sync) {
350
923k
  unique_ptr<WritableFile> file;
351
923k
  EnvOptions soptions;
352
923k
  Status s = env->NewWritableFile(fname, &file, soptions);
353
923k
  if (!s.ok()) {
354
0
    return s;
355
0
  }
356
923k
  s = file->Append(data);
357
923k
  if (s.ok() && should_sync) {
358
350k
    s = file->Sync();
359
350k
  }
360
923k
  if (!s.ok()) {
361
0
    env->CleanupFile(fname);
362
0
  }
363
923k
  return s;
364
923k
}
365
366
342k
Status ReadFileToString(Env* env, const std::string& fname, std::string* data) {
367
342k
  EnvOptions soptions;
368
342k
  data->clear();
369
342k
  std::unique_ptr<SequentialFile> file;
370
342k
  Status s = env->NewSequentialFile(fname, &file, soptions);
371
342k
  if (!s.ok()) {
372
0
    return s;
373
0
  }
374
342k
  static const int kBufferSize = 8192;
375
342k
  std::unique_ptr<uint8_t[]> space(new uint8_t[kBufferSize]);
376
685k
  while (true) {
377
685k
    Slice fragment;
378
685k
    s = file->Read(kBufferSize, &fragment, space.get());
379
685k
    if (!s.ok()) {
380
0
      break;
381
0
    }
382
685k
    data->append(fragment.cdata(), fragment.size());
383
685k
    if (fragment.empty()) {
384
342k
      break;
385
342k
    }
386
685k
  }
387
342k
  return s;
388
342k
}
389
390
Status EnvWrapper::NewSequentialFile(const std::string& f, std::unique_ptr<SequentialFile>* r,
391
1.87k
                                     const EnvOptions& options) {
392
1.87k
  return target_->NewSequentialFile(f, r, options);
393
1.87k
}
394
395
Status EnvWrapper::NewRandomAccessFile(const std::string& f,
396
                                       unique_ptr<RandomAccessFile>* r,
397
3.58k
                                       const EnvOptions& options) {
398
3.58k
  return target_->NewRandomAccessFile(f, r, options);
399
3.58k
}
400
401
Status EnvWrapper::NewWritableFile(const std::string& f, unique_ptr<WritableFile>* r,
402
1.53k
                                   const EnvOptions& options) {
403
1.53k
  return target_->NewWritableFile(f, r, options);
404
1.53k
}
405
406
Status EnvWrapper::ReuseWritableFile(const std::string& fname,
407
                                     const std::string& old_fname,
408
                                     unique_ptr<WritableFile>* r,
409
57
                                     const EnvOptions& options) {
410
57
  return target_->ReuseWritableFile(fname, old_fname, r, options);
411
57
}
412
413
Status EnvWrapper::NewDirectory(const std::string& name,
414
9.32k
                                unique_ptr<Directory>* result) {
415
9.32k
  return target_->NewDirectory(name, result);
416
9.32k
}
417
418
92.9k
Status EnvWrapper::FileExists(const std::string& f) {
419
92.9k
  return target_->FileExists(f);
420
92.9k
}
421
422
Status EnvWrapper::GetChildren(const std::string& dir,
423
65.6k
                               std::vector<std::string>* r) {
424
65.6k
  return target_->GetChildren(dir, r);
425
65.6k
}
426
427
Status EnvWrapper::GetChildrenFileAttributes(
428
0
    const std::string& dir, std::vector<FileAttributes>* result) {
429
0
  return target_->GetChildrenFileAttributes(dir, result);
430
0
}
431
432
160k
Status EnvWrapper::DeleteFile(const std::string& f) {
433
160k
  return target_->DeleteFile(f);
434
160k
}
435
436
3.23k
Status EnvWrapper::CreateDir(const std::string& d) {
437
3.23k
  return target_->CreateDir(d);
438
3.23k
}
439
440
28.1k
Status EnvWrapper::CreateDirIfMissing(const std::string& d) {
441
28.1k
  return target_->CreateDirIfMissing(d);
442
28.1k
}
443
444
4.16k
Status EnvWrapper::DeleteDir(const std::string& d) {
445
4.16k
  return target_->DeleteDir(d);
446
4.16k
}
447
448
115k
Status EnvWrapper::GetFileSize(const std::string& f, uint64_t* s) {
449
115k
  return target_->GetFileSize(f, s);
450
115k
}
451
452
Status EnvWrapper::GetFileModificationTime(const std::string& fname,
453
81
                               uint64_t* file_mtime) {
454
81
  return target_->GetFileModificationTime(fname, file_mtime);
455
81
}
456
457
33.3k
Status EnvWrapper::RenameFile(const std::string& s, const std::string& t) {
458
33.3k
  return target_->RenameFile(s, t);
459
33.3k
}
460
461
648
Status EnvWrapper::LinkFile(const std::string& s, const std::string& t) {
462
648
  return target_->LinkFile(s, t);
463
648
}
464
465
12.4k
Status EnvWrapper::LockFile(const std::string& f, FileLock** l) {
466
12.4k
  return target_->LockFile(f, l);
467
12.4k
}
468
469
12.4k
Status EnvWrapper::UnlockFile(FileLock* l) {
470
12.4k
  return target_->UnlockFile(l);
471
12.4k
}
472
473
581
Status EnvWrapper::GetTestDirectory(std::string* path) {
474
581
  return target_->GetTestDirectory(path);
475
581
}
476
477
Status EnvWrapper::NewLogger(const std::string& fname,
478
12.5k
                             shared_ptr<Logger>* result) {
479
12.5k
  return target_->NewLogger(fname, result);
480
12.5k
}
481
482
0
Status EnvWrapper::GetHostName(char* name, uint64_t len) {
483
0
  return target_->GetHostName(name, len);
484
0
}
485
486
280k
Status EnvWrapper::GetCurrentTime(int64_t* unix_time) {
487
280k
  return target_->GetCurrentTime(unix_time);
488
280k
}
489
490
Status EnvWrapper::GetAbsolutePath(const std::string& db_path,
491
21.6k
                                   std::string* output_path) {
492
21.6k
  return target_->GetAbsolutePath(db_path, output_path);
493
21.6k
}
494
495
659
EnvWrapper::~EnvWrapper() {
496
659
}
497
498
namespace {  // anonymous namespace
499
500
3.98M
void AssignEnvOptions(EnvOptions* env_options, const DBOptions& options) {
501
3.98M
  env_options->use_os_buffer = options.allow_os_buffer;
502
3.98M
  env_options->use_mmap_reads = options.allow_mmap_reads;
503
3.98M
  env_options->use_mmap_writes = options.allow_mmap_writes;
504
3.98M
  env_options->set_fd_cloexec = options.is_fd_close_on_exec;
505
3.98M
  env_options->bytes_per_sync = options.bytes_per_sync;
506
3.98M
  env_options->compaction_readahead_size = options.compaction_readahead_size;
507
3.98M
  env_options->random_access_max_buffer_size =
508
3.98M
      options.random_access_max_buffer_size;
509
3.98M
  env_options->rate_limiter = options.rate_limiter.get();
510
3.98M
  env_options->writable_file_max_buffer_size =
511
3.98M
      options.writable_file_max_buffer_size;
512
3.98M
  env_options->allow_fallocate = options.allow_fallocate;
513
3.98M
}
514
515
}  // anonymous namespace
516
517
EnvOptions Env::OptimizeForLogWrite(const EnvOptions& env_options,
518
28.1k
                                    const DBOptions& db_options) const {
519
28.1k
  EnvOptions optimized_env_options(env_options);
520
28.1k
  optimized_env_options.bytes_per_sync = db_options.wal_bytes_per_sync;
521
28.1k
  return optimized_env_options;
522
28.1k
}
523
524
11.2k
EnvOptions Env::OptimizeForManifestWrite(const EnvOptions& env_options) const {
525
11.2k
  return env_options;
526
11.2k
}
527
528
0
Status Env::LinkFile(const std::string& src, const std::string& target) {
529
0
  return STATUS(NotSupported, "LinkFile is not supported for this Env");
530
0
}
531
532
684k
EnvOptions::EnvOptions(const DBOptions& options) {
533
684k
  AssignEnvOptions(this, options);
534
684k
}
535
536
3.29M
EnvOptions::EnvOptions() {
537
3.29M
  DBOptions options;
538
3.29M
  AssignEnvOptions(this, options);
539
3.29M
}
540
541
48.3M
void WritableFile::PrepareWrite(size_t offset, size_t len) {
542
48.3M
  if (preallocation_block_size_ == 0) {
543
11.1M
    return;
544
11.1M
  }
545
  // If this write would cross one or more preallocation blocks,
546
  // determine what the last preallocation block necesessary to
547
  // cover this write would be and Allocate to that point.
548
37.1M
  const auto block_size = preallocation_block_size_;
549
37.1M
  size_t new_last_preallocated_block =
550
37.1M
    (offset + len + block_size - 1) / block_size;
551
37.1M
  if (new_last_preallocated_block > last_preallocated_block_) {
552
644k
    size_t num_spanned_blocks =
553
644k
      new_last_preallocated_block - last_preallocated_block_;
554
644k
    WARN_NOT_OK(
555
644k
        Allocate(block_size * last_preallocated_block_, block_size * num_spanned_blocks),
556
644k
        "Failed to pre-allocate space for a file");
557
644k
    last_preallocated_block_ = new_last_preallocated_block;
558
644k
  }
559
37.1M
}
560
561
0
Status WritableFile::PositionedAppend(const Slice& /* data */, uint64_t /* offset */) {
562
0
  return STATUS(NotSupported, "PositionedAppend not supported");
563
0
}
564
565
// Truncate is necessary to trim the file to the correct size
566
// before closing. It is not always possible to keep track of the file
567
// size due to whole pages writes. The behavior is undefined if called
568
// with other writes to follow.
569
0
Status WritableFile::Truncate(uint64_t size) {
570
0
  return Status::OK();
571
0
}
572
573
421
Status WritableFile::RangeSync(uint64_t offset, uint64_t nbytes) {
574
421
  return Status::OK();
575
421
}
576
577
444
Status WritableFile::Fsync() {
578
444
  return Sync();
579
444
}
580
581
9.50k
Status WritableFile::InvalidateCache(size_t offset, size_t length) {
582
9.50k
  return STATUS(NotSupported, "InvalidateCache not supported.");
583
9.50k
}
584
585
644k
Status WritableFile::Allocate(uint64_t offset, uint64_t len) {
586
644k
  return Status::OK();
587
644k
}
588
589
Status RocksDBFileFactoryWrapper::NewSequentialFile(
590
    const std::string& f, unique_ptr<SequentialFile>* r,
591
1.58M
    const rocksdb::EnvOptions& options) {
592
1.58M
  return target_->NewSequentialFile(f, r, options);
593
1.58M
}
594
Status RocksDBFileFactoryWrapper::NewRandomAccessFile(const std::string& f,
595
                                                      unique_ptr <rocksdb::RandomAccessFile>* r,
596
1.58M
                                                      const EnvOptions& options) {
597
1.58M
  return target_->NewRandomAccessFile(f, r, options);
598
1.58M
}
599
600
Status RocksDBFileFactoryWrapper::NewWritableFile(
601
    const std::string& f, unique_ptr <rocksdb::WritableFile>* r,
602
2.69M
    const EnvOptions& options) {
603
2.69M
  return target_->NewWritableFile(f, r, options);
604
2.69M
}
605
606
Status RocksDBFileFactoryWrapper::ReuseWritableFile(const std::string& fname,
607
                                                    const std::string& old_fname,
608
                                                    unique_ptr<WritableFile>* result,
609
0
                                                    const EnvOptions& options) {
610
0
  return target_->ReuseWritableFile(fname, old_fname, result, options);
611
0
}
612
613
3.08k
Status RocksDBFileFactoryWrapper::GetFileSize(const std::string& fname, uint64_t* size) {
614
3.08k
  return target_->GetFileSize(fname, size);
615
3.08k
}
616
617
99.5k
Status WritableFileWrapper::Append(const Slice& data) {
618
99.5k
  return target_->Append(data);
619
99.5k
}
620
621
0
Status WritableFileWrapper::PositionedAppend(const Slice& data, uint64_t offset) {
622
0
  return target_->PositionedAppend(data, offset);
623
0
}
624
625
24
Status WritableFileWrapper::Truncate(uint64_t size) {
626
24
  return target_->Truncate(size);
627
24
}
628
629
29
Status WritableFileWrapper::Close() {
630
29
  return target_->Close();
631
29
}
632
633
99.5k
Status WritableFileWrapper::Flush() {
634
99.5k
  return target_->Flush();
635
99.5k
}
636
637
21
Status WritableFileWrapper::Sync() {
638
21
  return target_->Sync();
639
21
}
640
641
5
Status WritableFileWrapper::Fsync() {
642
5
  return target_->Fsync();
643
5
}
644
645
1
Status WritableFileWrapper::InvalidateCache(size_t offset, size_t length) {
646
1
  return target_->InvalidateCache(offset, length);
647
1
}
648
649
1
Status WritableFileWrapper::Allocate(uint64_t offset, uint64_t len) {
650
1
  return target_->Allocate(offset, len);
651
1
}
652
653
1
Status WritableFileWrapper::RangeSync(uint64_t offset, uint64_t nbytes) {
654
1
  return target_->RangeSync(offset, nbytes);
655
1
}
656
657
}  // namespace rocksdb