Commit 3f8eaf7e authored by unknown's avatar unknown

Ending spaces removed.

parent 245298f2
...@@ -51,11 +51,11 @@ class Cassandra_se_impl: public Cassandra_se_interface ...@@ -51,11 +51,11 @@ class Cassandra_se_impl: public Cassandra_se_interface
ConsistencyLevel::type write_consistency; ConsistencyLevel::type write_consistency;
ConsistencyLevel::type read_consistency; ConsistencyLevel::type read_consistency;
/* How many times to retry an operation before giving up */ /* How many times to retry an operation before giving up */
int thrift_call_retries_to_do; int thrift_call_retries_to_do;
/* DDL data */ /* DDL data */
KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */ KsDef ks_def; /* KeySpace we're using (TODO: put this in table->share) */
CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/ CfDef cf_def; /* Column family we're using (TODO: put in table->share)*/
...@@ -68,15 +68,15 @@ class Cassandra_se_impl: public Cassandra_se_interface ...@@ -68,15 +68,15 @@ class Cassandra_se_impl: public Cassandra_se_interface
/* Insert preparation */ /* Insert preparation */
typedef std::map<std::string, std::vector<Mutation> > ColumnFamilyToMutation; typedef std::map<std::string, std::vector<Mutation> > ColumnFamilyToMutation;
typedef std::map<std::string, ColumnFamilyToMutation> KeyToCfMutationMap; typedef std::map<std::string, ColumnFamilyToMutation> KeyToCfMutationMap;
KeyToCfMutationMap batch_mutation; /* Prepare operation here */ KeyToCfMutationMap batch_mutation; /* Prepare operation here */
int64_t insert_timestamp; int64_t insert_timestamp;
std::vector<Mutation>* insert_list; std::vector<Mutation>* insert_list;
/* Resultset we're reading */ /* Resultset we're reading */
std::vector<KeySlice> key_slice_vec; std::vector<KeySlice> key_slice_vec;
std::vector<KeySlice>::iterator key_slice_it; std::vector<KeySlice>::iterator key_slice_it;
std::string rowkey; /* key of the record we're returning now */ std::string rowkey; /* key of the record we're returning now */
SlicePredicate slice_pred; SlicePredicate slice_pred;
...@@ -84,12 +84,12 @@ class Cassandra_se_impl: public Cassandra_se_interface ...@@ -84,12 +84,12 @@ class Cassandra_se_impl: public Cassandra_se_interface
bool get_slices_returned_less; bool get_slices_returned_less;
bool get_slice_found_rows; bool get_slice_found_rows;
public: public:
Cassandra_se_impl() : cass(NULL), Cassandra_se_impl() : cass(NULL),
write_consistency(ConsistencyLevel::ONE), write_consistency(ConsistencyLevel::ONE),
read_consistency(ConsistencyLevel::ONE), read_consistency(ConsistencyLevel::ONE),
thrift_call_retries_to_do(0) {} thrift_call_retries_to_do(0) {}
virtual ~Cassandra_se_impl(){ delete cass; } virtual ~Cassandra_se_impl(){ delete cass; }
/* Connection and DDL checks */ /* Connection and DDL checks */
bool connect(const char *host, int port, const char *keyspace); bool connect(const char *host, int port, const char *keyspace);
void set_column_family(const char *cfname) { column_family.assign(cfname); } void set_column_family(const char *cfname) { column_family.assign(cfname); }
...@@ -137,7 +137,7 @@ public: ...@@ -137,7 +137,7 @@ public:
void clear_read_columns(); void clear_read_columns();
void clear_read_all_columns(); void clear_read_all_columns();
void add_read_column(const char *name); void add_read_column(const char *name);
/* Reads, MRR scans */ /* Reads, MRR scans */
void new_lookup_keys(); void new_lookup_keys();
int add_lookup_key(const char *key, size_t key_len); int add_lookup_key(const char *key, size_t key_len);
...@@ -164,7 +164,7 @@ private: ...@@ -164,7 +164,7 @@ private:
/* Non-inherited utility functions: */ /* Non-inherited utility functions: */
int64_t get_i64_timestamp(); int64_t get_i64_timestamp();
typedef bool (Cassandra_se_impl::*retryable_func_t)(); typedef bool (Cassandra_se_impl::*retryable_func_t)();
bool try_operation(retryable_func_t func); bool try_operation(retryable_func_t func);
}; };
...@@ -182,17 +182,17 @@ Cassandra_se_interface *create_cassandra_se() ...@@ -182,17 +182,17 @@ Cassandra_se_interface *create_cassandra_se()
bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace_arg) bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace_arg)
{ {
bool res= true; bool res= true;
keyspace.assign(keyspace_arg); keyspace.assign(keyspace_arg);
try { try {
boost::shared_ptr<TTransport> socket = boost::shared_ptr<TTransport> socket =
boost::shared_ptr<TSocket>(new TSocket(host, port)); boost::shared_ptr<TSocket>(new TSocket(host, port));
boost::shared_ptr<TTransport> tr = boost::shared_ptr<TTransport> tr =
boost::shared_ptr<TFramedTransport>(new TFramedTransport (socket)); boost::shared_ptr<TFramedTransport>(new TFramedTransport (socket));
boost::shared_ptr<TProtocol> p = boost::shared_ptr<TProtocol> p =
boost::shared_ptr<TBinaryProtocol>(new TBinaryProtocol(tr)); boost::shared_ptr<TBinaryProtocol>(new TBinaryProtocol(tr));
cass= new CassandraClient(p); cass= new CassandraClient(p);
tr->open(); tr->open();
cass->set_keyspace(keyspace_arg); cass->set_keyspace(keyspace_arg);
...@@ -216,7 +216,7 @@ bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace ...@@ -216,7 +216,7 @@ bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace
} }
void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level, void Cassandra_se_impl::set_consistency_levels(ulong read_cons_level,
ulong write_cons_level) ulong write_cons_level)
{ {
write_cons_level= (ConsistencyLevel::type)(write_cons_level + 1); write_cons_level= (ConsistencyLevel::type)(write_cons_level + 1);
...@@ -229,7 +229,7 @@ bool Cassandra_se_impl::retryable_setup_ddl_checks() ...@@ -229,7 +229,7 @@ bool Cassandra_se_impl::retryable_setup_ddl_checks()
try { try {
cass->describe_keyspace(ks_def, keyspace); cass->describe_keyspace(ks_def, keyspace);
} catch (NotFoundException nfe) { } catch (NotFoundException nfe) {
print_error("keyspace `%s` not found: %s", keyspace.c_str(), nfe.what()); print_error("keyspace `%s` not found: %s", keyspace.c_str(), nfe.what());
return true; return true;
...@@ -261,7 +261,7 @@ void Cassandra_se_impl::first_ddl_column() ...@@ -261,7 +261,7 @@ void Cassandra_se_impl::first_ddl_column()
} }
bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len, bool Cassandra_se_impl::next_ddl_column(char **name, int *name_len,
char **type, int *type_len) char **type, int *type_len)
{ {
if (column_ddl_it == cf_def.column_metadata.end()) if (column_ddl_it == cf_def.column_metadata.end())
...@@ -314,7 +314,7 @@ int64_t Cassandra_se_impl::get_i64_timestamp() ...@@ -314,7 +314,7 @@ int64_t Cassandra_se_impl::get_i64_timestamp()
int64_t usec = td.tv_usec; int64_t usec = td.tv_usec;
usec = usec / 1000; usec = usec / 1000;
ms += usec; ms += usec;
return ms; return ms;
} }
...@@ -345,7 +345,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, ...@@ -345,7 +345,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len,
{ {
std::string key_to_delete; std::string key_to_delete;
key_to_delete.assign(key, key_len); key_to_delete.assign(key, key_len);
batch_mutation[key_to_delete]= ColumnFamilyToMutation(); batch_mutation[key_to_delete]= ColumnFamilyToMutation();
ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_delete]; ColumnFamilyToMutation& cf_mut= batch_mutation[key_to_delete];
...@@ -357,7 +357,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len, ...@@ -357,7 +357,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len,
mut.deletion.__isset.timestamp= true; mut.deletion.__isset.timestamp= true;
mut.deletion.timestamp= get_i64_timestamp(); mut.deletion.timestamp= get_i64_timestamp();
mut.deletion.__isset.predicate= true; mut.deletion.__isset.predicate= true;
/* /*
Attempting to delete columns with SliceRange causes exception with message Attempting to delete columns with SliceRange causes exception with message
"Deletion does not yet support SliceRange predicates". "Deletion does not yet support SliceRange predicates".
...@@ -439,7 +439,7 @@ bool Cassandra_se_impl::do_insert() ...@@ -439,7 +439,7 @@ bool Cassandra_se_impl::do_insert()
*/ */
if (batch_mutation.empty()) if (batch_mutation.empty())
return false; return false;
return try_operation(&Cassandra_se_impl::retryable_do_insert); return try_operation(&Cassandra_se_impl::retryable_do_insert);
} }
...@@ -449,7 +449,7 @@ bool Cassandra_se_impl::do_insert() ...@@ -449,7 +449,7 @@ bool Cassandra_se_impl::do_insert()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/* /*
Make one key lookup. If the record is found, the result is stored locally and Make one key lookup. If the record is found, the result is stored locally and
the caller should iterate over it. the caller should iterate over it.
*/ */
...@@ -475,7 +475,7 @@ bool Cassandra_se_impl::retryable_get_slice() ...@@ -475,7 +475,7 @@ bool Cassandra_se_impl::retryable_get_slice()
sr.finish = ""; sr.finish = "";
slice_pred.__set_slice_range(sr); slice_pred.__set_slice_range(sr);
cass->get_slice(column_data_vec, rowkey, cparent, slice_pred, cass->get_slice(column_data_vec, rowkey, cparent, slice_pred,
read_consistency); read_consistency);
if (column_data_vec.size() == 0) if (column_data_vec.size() == 0)
...@@ -548,7 +548,7 @@ void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len) ...@@ -548,7 +548,7 @@ void Cassandra_se_impl::get_read_rowkey(char **value, int *value_len)
bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key)
{ {
get_range_slices_param_last_key_as_start_key= last_key_as_start_key; get_range_slices_param_last_key_as_start_key= last_key_as_start_key;
return try_operation(&Cassandra_se_impl::retryable_get_range_slices); return try_operation(&Cassandra_se_impl::retryable_get_range_slices);
} }
...@@ -556,10 +556,10 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key) ...@@ -556,10 +556,10 @@ bool Cassandra_se_impl::get_range_slices(bool last_key_as_start_key)
bool Cassandra_se_impl::retryable_get_range_slices() bool Cassandra_se_impl::retryable_get_range_slices()
{ {
bool last_key_as_start_key= get_range_slices_param_last_key_as_start_key; bool last_key_as_start_key= get_range_slices_param_last_key_as_start_key;
ColumnParent cparent; ColumnParent cparent;
cparent.column_family= column_family; cparent.column_family= column_family;
/* SlicePredicate can be used to limit columns we will retrieve */ /* SlicePredicate can be used to limit columns we will retrieve */
KeyRange key_range; KeyRange key_range;
...@@ -620,7 +620,7 @@ restart: ...@@ -620,7 +620,7 @@ restart:
return false; return false;
} }
} }
/* /*
(1) - skip the last row that we have read in the previous batch. (1) - skip the last row that we have read in the previous batch.
(2) - Rows that were deleted show up as rows without any columns. Skip (2) - Rows that were deleted show up as rows without any columns. Skip
...@@ -710,16 +710,16 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) ...@@ -710,16 +710,16 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call)
res= true; res= true;
try { try {
if ((res= (this->*func_to_call)())) if ((res= (this->*func_to_call)()))
{ {
/* /*
The function call was made successfully (without timeouts, etc), The function call was made successfully (without timeouts, etc),
but something inside it returned 'true'. but something inside it returned 'true'.
This is supposedly a failure (or "not found" or other negative This is supposedly a failure (or "not found" or other negative
result). We need to return this to the caller. result). We need to return this to the caller.
*/ */
n_retries= 0; n_retries= 0;
} }
} catch (InvalidRequestException ire) { } catch (InvalidRequestException ire) {
...@@ -735,7 +735,7 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call) ...@@ -735,7 +735,7 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call)
print_error("TimedOutException: %s", te.what()); print_error("TimedOutException: %s", te.what());
}catch(TException e){ }catch(TException e){
/* todo: we may use retry for certain kinds of Thrift errors */ /* todo: we may use retry for certain kinds of Thrift errors */
n_retries= 0; n_retries= 0;
print_error("Thrift exception: %s", e.what()); print_error("Thrift exception: %s", e.what());
} catch (...) { } catch (...) {
n_retries= 0; /* Don't retry */ n_retries= 0; /* Don't retry */
......
...@@ -37,7 +37,7 @@ class Cassandra_se_interface ...@@ -37,7 +37,7 @@ class Cassandra_se_interface
{ {
public: public:
Cassandra_se_interface() { err_buffer[0]=0; } Cassandra_se_interface() { err_buffer[0]=0; }
virtual ~Cassandra_se_interface(){}; virtual ~Cassandra_se_interface(){};
/* Init */ /* Init */
virtual bool connect(const char *host, int port, const char *keyspace)=0; virtual bool connect(const char *host, int port, const char *keyspace)=0;
...@@ -45,11 +45,11 @@ public: ...@@ -45,11 +45,11 @@ public:
/* Settings */ /* Settings */
virtual void set_consistency_levels(ulong read_cons_level, ulong write_cons_level)=0; virtual void set_consistency_levels(ulong read_cons_level, ulong write_cons_level)=0;
/* Check underlying DDL */ /* Check underlying DDL */
virtual bool setup_ddl_checks()=0; virtual bool setup_ddl_checks()=0;
virtual void first_ddl_column()=0; virtual void first_ddl_column()=0;
virtual bool next_ddl_column(char **name, int *name_len, char **value, virtual bool next_ddl_column(char **name, int *name_len, char **value,
int *value_len)=0; int *value_len)=0;
virtual void get_rowkey_type(char **name, char **type)=0; virtual void get_rowkey_type(char **name, char **type)=0;
virtual size_t get_ddl_size()=0; virtual size_t get_ddl_size()=0;
...@@ -106,7 +106,7 @@ class Cassandra_status_vars ...@@ -106,7 +106,7 @@ class Cassandra_status_vars
public: public:
ulong row_inserts; ulong row_inserts;
ulong row_insert_batches; ulong row_insert_batches;
ulong multiget_reads; ulong multiget_reads;
ulong multiget_keys_scanned; ulong multiget_keys_scanned;
ulong multiget_rows_read; ulong multiget_rows_read;
......
This diff is collapsed.
/* /*
Copyright (c) 2012, Monty Program Ab Copyright (c) 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
...@@ -106,7 +106,7 @@ class ha_cassandra: public handler ...@@ -106,7 +106,7 @@ class ha_cassandra: public handler
/* Used to produce 'wrong column %s at row %lu' warnings */ /* Used to produce 'wrong column %s at row %lu' warnings */
ha_rows insert_lineno; ha_rows insert_lineno;
void print_conversion_error(const char *field_name, void print_conversion_error(const char *field_name,
char *cass_value, int cass_value_len); char *cass_value, int cass_value_len);
int connect_and_check_options(TABLE *table_arg); int connect_and_check_options(TABLE *table_arg);
public: public:
...@@ -144,12 +144,12 @@ public: ...@@ -144,12 +144,12 @@ public:
We are saying that this engine is just statement capable to have We are saying that this engine is just statement capable to have
an engine that can only handle statement-based logging. This is an engine that can only handle statement-based logging. This is
used in testing. used in testing.
HA_REC_NOT_IN_SEQ HA_REC_NOT_IN_SEQ
If we don't set it, filesort crashes, because it assumes rowids are If we don't set it, filesort crashes, because it assumes rowids are
1..8 byte numbers 1..8 byte numbers
*/ */
return HA_BINLOG_STMT_CAPABLE | return HA_BINLOG_STMT_CAPABLE |
HA_REC_NOT_IN_SEQ; HA_REC_NOT_IN_SEQ;
} }
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
support indexes. support indexes.
*/ */
uint max_supported_key_length() const { return 16*1024; /* just to return something*/ } uint max_supported_key_length() const { return 16*1024; /* just to return something*/ }
int index_init(uint idx, bool sorted); int index_init(uint idx, bool sorted);
int index_read_map(uchar * buf, const uchar * key, int index_read_map(uchar * buf, const uchar * key,
...@@ -211,19 +211,19 @@ public: ...@@ -211,19 +211,19 @@ public:
virtual void start_bulk_insert(ha_rows rows); virtual void start_bulk_insert(ha_rows rows);
virtual int end_bulk_insert(); virtual int end_bulk_insert();
virtual int reset(); virtual int reset();
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mode, HANDLER_BUFFER *buf); uint n_ranges, uint mode, HANDLER_BUFFER *buf);
int multi_range_read_next(range_id_t *range_info); int multi_range_read_next(range_id_t *range_info);
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param, void *seq_init_param,
uint n_ranges, uint *bufsz, uint n_ranges, uint *bufsz,
uint *flags, COST_VECT *cost); uint *flags, COST_VECT *cost);
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
uint key_parts, uint *bufsz, uint key_parts, uint *bufsz,
uint *flags, COST_VECT *cost); uint *flags, COST_VECT *cost);
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment