@@ -46,8 +46,10 @@ class Rdb_key_def;
4646class Rdb_tbl_def ;
4747
4848class Rdb_index_merge {
49- Rdb_index_merge (const Rdb_index_merge &p) = delete ;
50- Rdb_index_merge &operator =(const Rdb_index_merge &p) = delete ;
49+ Rdb_index_merge (const Rdb_index_merge &) = delete ;
50+ Rdb_index_merge &operator =(const Rdb_index_merge &) = delete ;
51+ Rdb_index_merge (const Rdb_index_merge &&) = delete ;
52+ Rdb_index_merge &operator =(Rdb_index_merge &&) = delete ;
5153
5254 public:
5355 /* Information about temporary files used in external merge sort */
@@ -67,15 +69,13 @@ class Rdb_index_merge {
6769 ulonglong m_disk_curr_offset; /* current offset on disk */
6870 uint64 m_total_size; /* total # of data bytes in chunk */
6971
70- void store_key_value (const rocksdb::Slice &key, const rocksdb::Slice &val)
71- MY_ATTRIBUTE((__nonnull__));
72+ void store_key_value (const rocksdb::Slice &key, const rocksdb::Slice &val);
7273
73- void store_slice (const rocksdb::Slice &slice) MY_ATTRIBUTE((__nonnull__)) ;
74+ void store_slice (const rocksdb::Slice &slice);
7475
75- size_t prepare (File fd, ulonglong f_offset) MY_ATTRIBUTE((__nonnull__) );
76+ [[nodiscard]] size_t prepare (File fd, ulonglong f_offset);
7677
77- int read_next_chunk_from_disk (File fd)
78- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
78+ [[nodiscard]] int read_next_chunk_from_disk (File fd);
7979
8080 inline bool is_chunk_finished () const {
8181 return m_curr_offset + m_disk_curr_offset - m_disk_start_offset ==
@@ -109,17 +109,16 @@ class Rdb_index_merge {
109109 rocksdb::Slice m_key; /* current key pointed to by block ptr */
110110 rocksdb::Slice m_val;
111111
112- size_t prepare (File fd, ulonglong f_offset, ulonglong chunk_size)
113- MY_ATTRIBUTE((__nonnull__) );
112+ [[nodiscard]] size_t prepare (File fd, ulonglong f_offset,
113+ ulonglong chunk_size );
114114
115- int read_next_chunk_from_disk (File fd)
116- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
115+ [[nodiscard]] int read_next_chunk_from_disk (File fd);
117116
118- int read_rec (rocksdb::Slice *const key, rocksdb::Slice * const val)
119- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
117+ [[nodiscard]] int read_rec (rocksdb::Slice *const key,
118+ rocksdb::Slice * const val );
120119
121- int read_slice (rocksdb::Slice *const slice, const uchar **block_ptr)
122- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
120+ [[nodiscard]] int read_slice (rocksdb::Slice *const slice,
121+ const uchar **block_ptr );
123122
124123 explicit merge_heap_entry (const rocksdb::Comparator *const comparator)
125124 : m_chunk_info(nullptr ), m_block(nullptr ), m_comparator(comparator) {}
@@ -152,7 +151,7 @@ class Rdb_index_merge {
152151 const ulonglong m_merge_buf_size;
153152 const ulonglong m_merge_combine_read_size;
154153 const ulonglong m_merge_tmp_file_removal_delay;
155- rocksdb::ColumnFamilyHandle * m_cf_handle;
154+ rocksdb::ColumnFamilyHandle & m_cf_handle;
156155 struct merge_file_info m_merge_file;
157156 std::shared_ptr<merge_buf_info> m_rec_buf_unsorted;
158157 std::shared_ptr<merge_buf_info> m_output_buf;
@@ -180,9 +179,9 @@ class Rdb_index_merge {
180179 return rocksdb::Slice (reinterpret_cast <const char *>(block), len);
181180 }
182181
183- static int merge_record_compare (const uchar *a_block, const uchar *b_block,
184- const rocksdb::Comparator * const comparator)
185- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__ ));
182+ [[nodiscard]] static int merge_record_compare (
183+ const uchar *a_block, const uchar *b_block,
184+ const rocksdb::Comparator * const comparator) MY_ATTRIBUTE((__nonnull__));
186185
187186 void merge_read_rec (const uchar *const block, rocksdb::Slice *const key,
188187 rocksdb::Slice *const val) MY_ATTRIBUTE((__nonnull__));
@@ -191,37 +190,36 @@ class Rdb_index_merge {
191190 MY_ATTRIBUTE((__nonnull__));
192191
193192 public:
194- Rdb_index_merge (const char *const tmpfile_path,
195- const ulonglong merge_buf_size,
196- const ulonglong merge_combine_read_size,
197- const ulonglong merge_tmp_file_removal_delay,
198- rocksdb::ColumnFamilyHandle *cf);
193+ Rdb_index_merge (const char *tmpfile_path, ulonglong merge_buf_size,
194+ ulonglong merge_combine_read_size,
195+ ulonglong merge_tmp_file_removal_delay,
196+ rocksdb::ColumnFamilyHandle &cf);
199197 ~Rdb_index_merge ();
200198
201- int init () MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
199+ [[nodiscard]] int init ();
202200
203- int merge_file_create () MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
201+ [[nodiscard]] int merge_file_create ();
204202
205- int add (const rocksdb::Slice &key, const rocksdb::Slice &val)
206- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
203+ [[nodiscard]] int add (const rocksdb::Slice &key, const rocksdb::Slice &val);
207204
208- int merge_buf_write () MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
205+ [[nodiscard]] int merge_buf_write ();
209206
210- int next (rocksdb::Slice *const key, rocksdb::Slice *const val)
211- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
207+ [[nodiscard]] int next (rocksdb::Slice *const key, rocksdb::Slice *const val);
212208
213- int merge_heap_prepare () MY_ATTRIBUTE((__nonnull__, __warn_unused_result__) );
209+ [[nodiscard]] int merge_heap_prepare ();
214210
215211 void merge_heap_top (rocksdb::Slice *key, rocksdb::Slice *val)
216212 MY_ATTRIBUTE((__nonnull__));
217213
218- int merge_heap_pop_and_get_next (rocksdb::Slice *const key,
219- rocksdb::Slice *const val)
220- MY_ATTRIBUTE((__nonnull__, __warn_unused_result__ ));
214+ [[nodiscard]] int merge_heap_pop_and_get_next (rocksdb::Slice *const key,
215+ rocksdb::Slice *const val)
216+ MY_ATTRIBUTE((__nonnull__));
221217
222218 void merge_reset ();
223219
224- rocksdb::ColumnFamilyHandle *get_cf () const { return m_cf_handle; }
225- };
220+ [[nodiscard]] rocksdb::ColumnFamilyHandle &get_cf () const {
221+ return m_cf_handle;
222+ }
223+ };
226224
227225} // namespace myrocks
0 commit comments