YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/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.23k
Env::~Env() {
35
2.23k
}
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
0
  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(); 
++i12
) {
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
422k
void Env::CleanupFile(const std::string& fname) {
87
422k
  WARN_NOT_OK(DeleteFile(fname), "Failed to cleanup " + fname);
88
422k
}
89
90
void Env::GetChildrenWarnNotOk(const std::string& dir,
91
1.27M
                               std::vector<std::string>* result) {
92
1.27M
  WARN_NOT_OK(GetChildren(dir, result), "Failed to get children " + dir);
93
1.27M
}
94
95
3.81M
WritableFile::~WritableFile() {
96
3.81M
}
97
98
654k
Logger::~Logger() {
99
654k
}
100
101
816k
FileLock::~FileLock() {
102
816k
}
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
159k
                    ...) {
115
159k
  if (info_log && 
info_log->GetInfoLogLevel() <= InfoLogLevel::INFO_LEVEL159k
) {
116
159k
    va_list ap;
117
159k
    va_start(ap, format);
118
159k
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
119
159k
    va_end(ap);
120
159k
  }
121
159k
}
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.99M
    va_list ap) {
132
1.99M
  static const char* kInfoLogLevelNames[6] = {"DEBUG", "INFO", "WARN", "ERROR", "FATAL", "HEADER"};
133
1.99M
  static_assert(
134
1.99M
      sizeof(kInfoLogLevelNames) / sizeof(kInfoLogLevelNames[0]) == NUM_INFO_LOG_LEVELS,
135
1.99M
      "kInfoLogLevelNames must have an element for each log level");
136
1.99M
  if (log_level < log_level_) {
137
0
    return;
138
0
  }
139
140
1.99M
  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
623k
    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.99M
}
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
758k
                    ...) {
162
758k
  if (info_log && 
info_log->GetInfoLogLevel() <= log_level756k
) {
163
332k
    va_list ap;
164
332k
    va_start(ap, format);
165
166
332k
    if (log_level == InfoLogLevel::HEADER_LEVEL) {
167
22
      info_log->LogHeaderWithContext(file, line, format, ap);
168
332k
    } else {
169
332k
      info_log->LogvWithContext(file, line, log_level, format, ap);
170
332k
    }
171
172
332k
    va_end(ap);
173
332k
  }
174
758k
}
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
97.5k
    Logger *info_log, const char *format, ...) {
188
// Log level should be higher than DEBUG, but including the ifndef for compiletime optimization.
189
97.5k
#ifndef NDEBUG
190
97.5k
  if (info_log && 
info_log->GetInfoLogLevel() <= InfoLogLevel::DEBUG_LEVEL97.5k
) {
191
84.6k
    va_list ap;
192
84.6k
    va_start(ap, format);
193
84.6k
    info_log->LogvWithContext(file, line, InfoLogLevel::DEBUG_LEVEL, format, ap);
194
84.6k
    va_end(ap);
195
84.6k
  }
196
97.5k
#endif
197
97.5k
}
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
409
    Logger *info_log, const char *format, ...) {
211
409
  if (info_log && 
info_log->GetInfoLogLevel() <= InfoLogLevel::WARN_LEVEL203
) {
212
200
    va_list ap;
213
200
    va_start(ap, format);
214
200
    info_log->LogvWithContext(file, line, InfoLogLevel::WARN_LEVEL, format, ap);
215
200
    va_end(ap);
216
200
  }
217
409
}
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
3.35M
void LogFlush(const shared_ptr<Logger>& info_log) {
238
3.35M
  if (info_log) {
239
3.35M
    info_log->Flush();
240
3.35M
  }
241
3.35M
}
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
4.77M
                    ...) {
249
4.77M
  if (info_log) {
250
4.77M
    va_list ap;
251
4.77M
    va_start(ap, format);
252
4.77M
    info_log->LogvWithContext(file, line, log_level, format, ap);
253
4.77M
    va_end(ap);
254
4.77M
  }
255
4.77M
}
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
17.6k
                    ...) {
340
17.6k
  if (info_log) {
341
17.6k
    va_list ap;
342
17.6k
    va_start(ap, format);
343
17.6k
    info_log->LogvWithContext(file, line, InfoLogLevel::INFO_LEVEL, format, ap);
344
17.6k
    va_end(ap);
345
17.6k
  }
346
17.6k
}
347
348
Status WriteStringToFile(Env* env, const Slice& data, const std::string& fname,
349
1.13M
                         bool should_sync) {
350
1.13M
  unique_ptr<WritableFile> file;
351
1.13M
  EnvOptions soptions;
352
1.13M
  Status s = env->NewWritableFile(fname, &file, soptions);
353
1.13M
  if (!s.ok()) {
354
2
    return s;
355
2
  }
356
1.13M
  s = file->Append(data);
357
1.13M
  if (
s.ok()1.13M
&& should_sync) {
358
443k
    s = file->Sync();
359
443k
  }
360
1.13M
  if (!s.ok()) {
361
0
    env->CleanupFile(fname);
362
0
  }
363
1.13M
  return s;
364
1.13M
}
365
366
436k
Status ReadFileToString(Env* env, const std::string& fname, std::string* data) {
367
436k
  EnvOptions soptions;
368
436k
  data->clear();
369
436k
  std::unique_ptr<SequentialFile> file;
370
436k
  Status s = env->NewSequentialFile(fname, &file, soptions);
371
436k
  if (!s.ok()) {
372
2
    return s;
373
2
  }
374
436k
  static const int kBufferSize = 8192;
375
436k
  std::unique_ptr<uint8_t[]> space(new uint8_t[kBufferSize]);
376
873k
  while (
true873k
) {
377
873k
    Slice fragment;
378
873k
    s = file->Read(kBufferSize, &fragment, space.get());
379
873k
    if (!s.ok()) {
380
0
      break;
381
0
    }
382
873k
    data->append(fragment.cdata(), fragment.size());
383
873k
    if (fragment.empty()) {
384
437k
      break;
385
437k
    }
386
873k
  }
387
436k
  return s;
388
436k
}
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
93.0k
Status EnvWrapper::FileExists(const std::string& f) {
419
93.0k
  return target_->FileExists(f);
420
93.0k
}
421
422
Status EnvWrapper::GetChildren(const std::string& dir,
423
63.0k
                               std::vector<std::string>* r) {
424
63.0k
  return target_->GetChildren(dir, r);
425
63.0k
}
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
116k
Status EnvWrapper::GetFileSize(const std::string& f, uint64_t* s) {
449
116k
  return target_->GetFileSize(f, s);
450
116k
}
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
652
Status EnvWrapper::LinkFile(const std::string& s, const std::string& t) {
462
652
  return target_->LinkFile(s, t);
463
652
}
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
661
EnvWrapper::~EnvWrapper() {
496
661
}
497
498
namespace {  // anonymous namespace
499
500
5.03M
void AssignEnvOptions(EnvOptions* env_options, const DBOptions& options) {
501
5.03M
  env_options->use_os_buffer = options.allow_os_buffer;
502
5.03M
  env_options->use_mmap_reads = options.allow_mmap_reads;
503
5.03M
  env_options->use_mmap_writes = options.allow_mmap_writes;
504
5.03M
  env_options->set_fd_cloexec = options.is_fd_close_on_exec;
505
5.03M
  env_options->bytes_per_sync = options.bytes_per_sync;
506
5.03M
  env_options->compaction_readahead_size = options.compaction_readahead_size;
507
5.03M
  env_options->random_access_max_buffer_size =
508
5.03M
      options.random_access_max_buffer_size;
509
5.03M
  env_options->rate_limiter = options.rate_limiter.get();
510
5.03M
  env_options->writable_file_max_buffer_size =
511
5.03M
      options.writable_file_max_buffer_size;
512
5.03M
  env_options->allow_fallocate = options.allow_fallocate;
513
5.03M
}
514
515
}  // anonymous namespace
516
517
EnvOptions Env::OptimizeForLogWrite(const EnvOptions& env_options,
518
28.0k
                                    const DBOptions& db_options) const {
519
28.0k
  EnvOptions optimized_env_options(env_options);
520
28.0k
  optimized_env_options.bytes_per_sync = db_options.wal_bytes_per_sync;
521
28.0k
  return optimized_env_options;
522
28.0k
}
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
872k
EnvOptions::EnvOptions(const DBOptions& options) {
533
872k
  AssignEnvOptions(this, options);
534
872k
}
535
536
4.16M
EnvOptions::EnvOptions() {
537
4.16M
  DBOptions options;
538
4.16M
  AssignEnvOptions(this, options);
539
4.16M
}
540
541
49.3M
void WritableFile::PrepareWrite(size_t offset, size_t len) {
542
49.3M
  if (preallocation_block_size_ == 0) {
543
11.5M
    return;
544
11.5M
  }
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.8M
  const auto block_size = preallocation_block_size_;
549
37.8M
  size_t new_last_preallocated_block =
550
37.8M
    (offset + len + block_size - 1) / block_size;
551
37.8M
  if (new_last_preallocated_block > last_preallocated_block_) {
552
759k
    size_t num_spanned_blocks =
553
759k
      new_last_preallocated_block - last_preallocated_block_;
554
759k
    WARN_NOT_OK(
555
759k
        Allocate(block_size * last_preallocated_block_, block_size * num_spanned_blocks),
556
759k
        "Failed to pre-allocate space for a file");
557
759k
    last_preallocated_block_ = new_last_preallocated_block;
558
759k
  }
559
37.8M
}
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
1.61k
Status WritableFile::RangeSync(uint64_t offset, uint64_t nbytes) {
574
1.61k
  return Status::OK();
575
1.61k
}
576
577
444
Status WritableFile::Fsync() {
578
444
  return Sync();
579
444
}
580
581
4.42k
Status WritableFile::InvalidateCache(size_t offset, size_t length) {
582
4.42k
  return STATUS(NotSupported, "InvalidateCache not supported.");
583
4.42k
}
584
585
759k
Status WritableFile::Allocate(uint64_t offset, uint64_t len) {
586
759k
  return Status::OK();
587
759k
}
588
589
Status RocksDBFileFactoryWrapper::NewSequentialFile(
590
    const std::string& f, unique_ptr<SequentialFile>* r,
591
2.01M
    const rocksdb::EnvOptions& options) {
592
2.01M
  return target_->NewSequentialFile(f, r, options);
593
2.01M
}
594
Status RocksDBFileFactoryWrapper::NewRandomAccessFile(const std::string& f,
595
                                                      unique_ptr <rocksdb::RandomAccessFile>* r,
596
2.02M
                                                      const EnvOptions& options) {
597
2.02M
  return target_->NewRandomAccessFile(f, r, options);
598
2.02M
}
599
600
Status RocksDBFileFactoryWrapper::NewWritableFile(
601
    const std::string& f, unique_ptr <rocksdb::WritableFile>* r,
602
3.33M
    const EnvOptions& options) {
603
3.33M
  return target_->NewWritableFile(f, r, options);
604
3.33M
}
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
5.31k
Status RocksDBFileFactoryWrapper::GetFileSize(const std::string& fname, uint64_t* size) {
614
5.31k
  return target_->GetFileSize(fname, size);
615
5.31k
}
616
617
99.6k
Status WritableFileWrapper::Append(const Slice& data) {
618
99.6k
  return target_->Append(data);
619
99.6k
}
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