Skip to content

Commit b2bc837

Browse files
committed
Cassandra: Define ha_cassandra::records_in_range()
The definition of the member function ha_cassandra::records_in_range() was inadvertently removed (renamed to a non-member function) in commit ff64152. Let us define the overridden member function inline, and add C++11 override qualifiers.
1 parent 37c1469 commit b2bc837

File tree

2 files changed

+47
-48
lines changed

2 files changed

+47
-48
lines changed

storage/cassandra/ha_cassandra.cc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2012, Monty Program Ab
2+
Copyright (c) 2012, 2020, MariaDB Corporation.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -2527,15 +2527,6 @@ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd,
25272527
}
25282528

25292529

2530-
ha_rows records_in_range(uint inx, const key_range *min_key,
2531-
const key_range *max_key,
2532-
page_range *res)
2533-
{
2534-
DBUG_ENTER("ha_cassandra::records_in_range");
2535-
DBUG_RETURN(HA_POS_ERROR); /* Range scans are not supported */
2536-
}
2537-
2538-
25392530
/**
25402531
check_if_incompatible_data() called if ALTER TABLE can't detect otherwise
25412532
if new and old definition are compatible

storage/cassandra/ha_cassandra.h

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2012, Monty Program Ab
2+
Copyright (c) 2012, 2020, MariaDB Corporation.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -129,13 +129,13 @@ class ha_cassandra: public handler
129129
The name of the index type that will be used for display.
130130
Don't implement this method unless you really have indexes.
131131
*/
132-
const char *index_type(uint inx) { return "HASH"; }
132+
const char *index_type(uint) override { return "HASH"; }
133133

134134
/** @brief
135135
This is a list of flags that indicate what functionality the storage engine
136136
implements. The current table flags are documented in handler.h
137137
*/
138-
ulonglong table_flags() const
138+
ulonglong table_flags() const override
139139
{
140140
return HA_BINLOG_STMT_CAPABLE |
141141
HA_REC_NOT_IN_SEQ |
@@ -157,7 +157,7 @@ class ha_cassandra: public handler
157157
If all_parts is set, MySQL wants to know the flags for the combined
158158
index, up to and including 'part'.
159159
*/
160-
ulong index_flags(uint inx, uint part, bool all_parts) const
160+
ulong index_flags(uint, uint, bool) const override
161161
{
162162
return 0;
163163
}
@@ -169,11 +169,11 @@ class ha_cassandra: public handler
169169
send. Return *real* limits of your storage engine here; MySQL will do
170170
min(your_limits, MySQL_limits) automatically.
171171
*/
172-
uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
172+
uint max_supported_record_length() const override {return HA_MAX_REC_LENGTH;}
173173

174174
/* Support only one Primary Key, for now */
175-
uint max_supported_keys() const { return 1; }
176-
uint max_supported_key_parts() const { return 1; }
175+
uint max_supported_keys() const override { return 1; }
176+
uint max_supported_key_parts() const override { return 1; }
177177

178178
/** @brief
179179
unireg.cc will call this to make sure that the storage engine can handle
@@ -184,42 +184,48 @@ class ha_cassandra: public handler
184184
There is no need to implement ..._key_... methods if your engine doesn't
185185
support indexes.
186186
*/
187-
uint max_supported_key_length() const { return 16*1024; /* just to return something*/ }
187+
uint max_supported_key_length() const override
188+
{ return 16*1024; /* just to return something*/ }
188189

189-
int index_init(uint idx, bool sorted);
190+
int index_init(uint idx, bool sorted) override;
190191

191192
int index_read_map(uchar * buf, const uchar * key,
192193
key_part_map keypart_map,
193-
enum ha_rkey_function find_flag);
194+
enum ha_rkey_function find_flag) override;
194195

195196
/** @brief
196197
Called in test_quick_select to determine if indexes should be used.
197198
*/
198-
virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; }
199+
double scan_time() override
200+
{ return (double) (stats.records+stats.deleted) / 20.0+10; }
199201

200202
/** @brief
201203
This method will never be called if you do not implement indexes.
202204
*/
203-
virtual double read_time(uint, uint, ha_rows rows)
205+
double read_time(uint, uint, ha_rows rows) override
204206
{ return (double) rows / 20.0+1; }
205207

206-
virtual void start_bulk_insert(ha_rows rows, uint flags);
207-
virtual int end_bulk_insert();
208+
void start_bulk_insert(ha_rows rows, uint flags) override;
209+
int end_bulk_insert() override;
208210

209-
virtual int reset();
211+
int reset() override;
210212

211213

212214
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
213-
uint n_ranges, uint mode, HANDLER_BUFFER *buf);
214-
int multi_range_read_next(range_id_t *range_info);
215+
uint n_ranges, uint mode, HANDLER_BUFFER *buf)
216+
override;
217+
int multi_range_read_next(range_id_t *range_info) override;
215218
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
216219
void *seq_init_param,
217220
uint n_ranges, uint *bufsz,
218-
uint *flags, Cost_estimate *cost);
221+
uint *flags, Cost_estimate *cost)
222+
override;
219223
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
220224
uint key_parts, uint *bufsz,
221-
uint *flags, Cost_estimate *cost);
222-
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size);
225+
uint *flags, Cost_estimate *cost)
226+
override;
227+
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size)
228+
override;
223229

224230
private:
225231
bool source_exhausted;
@@ -236,12 +242,12 @@ class ha_cassandra: public handler
236242
CASSANDRA_TYPE_DEF * get_cassandra_field_def(char *cass_name,
237243
int cass_name_length);
238244
public:
239-
int open(const char *name, int mode, uint test_if_locked);
240-
int close(void);
245+
int open(const char *name, int mode, uint test_if_locked) override;
246+
int close() override;
241247

242-
int write_row(const uchar *buf);
243-
int update_row(const uchar *old_data, const uchar *new_data);
244-
int delete_row(const uchar *buf);
248+
int write_row(const uchar *buf) override;
249+
int update_row(const uchar *old_data, const uchar *new_data) override;
250+
int delete_row(const uchar *buf) override;
245251

246252
/** @brief
247253
Unlike index_init(), rnd_init() can be called two consecutive times
@@ -251,29 +257,31 @@ class ha_cassandra: public handler
251257
cursor to the start of the table; no need to deallocate and allocate
252258
it again. This is a required method.
253259
*/
254-
int rnd_init(bool scan); //required
255-
int rnd_end();
256-
int rnd_next(uchar *buf); ///< required
257-
int rnd_pos(uchar *buf, uchar *pos); ///< required
258-
void position(const uchar *record); ///< required
259-
int info(uint); ///< required
260-
int delete_all_rows(void);
261-
ha_rows records_in_range(uint inx, const key_range *min_key,
260+
int rnd_init(bool scan) override;
261+
int rnd_end() override;
262+
int rnd_next(uchar *buf) override;
263+
int rnd_pos(uchar *buf, uchar *pos) override;
264+
void position(const uchar *record) override;
265+
int info(uint) override;
266+
int delete_all_rows() override;
267+
ha_rows records_in_range(uint, const key_range *min_key,
262268
const key_range *max_key,
263-
page_range *res);
269+
page_range *res) override
270+
{ return HA_POS_ERROR; /* Range scans are not supported */ }
271+
264272
int create(const char *name, TABLE *form,
265-
HA_CREATE_INFO *create_info); ///< required
273+
HA_CREATE_INFO *create_info) override;
266274
bool check_if_incompatible_data(HA_CREATE_INFO *info,
267-
uint table_changes);
275+
uint table_changes) override;
268276

269277
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
270-
enum thr_lock_type lock_type); ///< required
278+
enum thr_lock_type lock_type) override;
271279

272280
my_bool register_query_cache_table(THD *thd, const char *table_key,
273281
uint key_length,
274282
qc_engine_callback
275283
*engine_callback,
276-
ulonglong *engine_data)
284+
ulonglong *engine_data) override
277285
{
278286
/*
279287
Do not put data from Cassandra tables into query cache (because there

0 commit comments

Comments
 (0)