blob: ba9834dfef6eceae0adecf081fb0f29ea116fdf0 [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001From 512aaf3d833973f6146c6f1235b590901876175e Mon Sep 17 00:00:00 2001
2From: biocodz <biocodz@protonmail.com>
3Date: Fri, 7 Jun 2019 09:49:37 -0400
4Subject: [PATCH] fix Issue 5303
5
6Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/5426]
7
8---
9 db/internal_stats.h | 21 +++++++++++++++++++++
10 db/version_edit.h | 8 ++++++++
11 utilities/persistent_cache/persistent_cache_util.h | 2 +-
12 3 files changed, 30 insertions(+), 1 deletion(-)
13
14diff --git a/db/internal_stats.h b/db/internal_stats.h
15index 6fa8727a4..09447644d 100644
16--- a/db/internal_stats.h
17+++ b/db/internal_stats.h
18@@ -236,6 +236,27 @@ class InternalStats {
19 }
20 }
21
22+ CompactionStats & operator=(const CompactionStats& c) {
23+ count = c.count;
24+ micros = c.micros;
25+ cpu_micros = c.cpu_micros;
26+ bytes_read_non_output_levels = c.bytes_read_non_output_levels;
27+ bytes_read_output_level = c.bytes_read_output_level;
28+ bytes_written = c.bytes_written;
29+ bytes_moved = c.bytes_moved;
30+ num_input_files_in_non_output_levels =
31+ c.num_input_files_in_non_output_levels;
32+ num_input_files_in_output_level = c.num_input_files_in_output_level;
33+ num_output_files = c.num_output_files;
34+ num_input_records = c.num_input_records;
35+ num_dropped_records = c.num_dropped_records;
36+ int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
37+ for (int i = 0; i < num_of_reasons; i++) {
38+ counts[i] = c.counts[i];
39+ }
40+ return *this;
41+ }
42+
43 void Clear() {
44 this->micros = 0;
45 this->cpu_micros = 0;
46diff --git a/db/version_edit.h b/db/version_edit.h
47index 229531792..5c50ef552 100644
48--- a/db/version_edit.h
49+++ b/db/version_edit.h
50@@ -52,6 +52,14 @@ struct FileDescriptor {
51 smallest_seqno(_smallest_seqno),
52 largest_seqno(_largest_seqno) {}
53
54+ FileDescriptor(const FileDescriptor& fd) {
55+ table_reader = fd.table_reader;
56+ packed_number_and_path_id = fd.packed_number_and_path_id;
57+ file_size = fd.file_size;
58+ smallest_seqno = fd.smallest_seqno;
59+ largest_seqno = fd.largest_seqno;
60+ }
61+
62 FileDescriptor& operator=(const FileDescriptor& fd) {
63 table_reader = fd.table_reader;
64 packed_number_and_path_id = fd.packed_number_and_path_id;
65diff --git a/utilities/persistent_cache/persistent_cache_util.h b/utilities/persistent_cache/persistent_cache_util.h
66index 214bb5875..254c038f9 100644
67--- a/utilities/persistent_cache/persistent_cache_util.h
68+++ b/utilities/persistent_cache/persistent_cache_util.h
69@@ -48,7 +48,7 @@ class BoundedQueue {
70 T t = std::move(q_.front());
71 size_ -= t.Size();
72 q_.pop_front();
73- return std::move(t);
74+ return t;
75 }
76
77 size_t Size() const {
78--
792.11.0
80