Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3f8eaf7e
Commit
3f8eaf7e
authored
Sep 28, 2012
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ending spaces removed.
parent
245298f2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
100 deletions
+100
-100
storage/cassandra/cassandra_se.cc
storage/cassandra/cassandra_se.cc
+32
-32
storage/cassandra/cassandra_se.h
storage/cassandra/cassandra_se.h
+4
-4
storage/cassandra/ha_cassandra.cc
storage/cassandra/ha_cassandra.cc
+52
-52
storage/cassandra/ha_cassandra.h
storage/cassandra/ha_cassandra.h
+12
-12
No files found.
storage/cassandra/cassandra_se.cc
View file @
3f8eaf7e
...
...
@@ -51,11 +51,11 @@ class Cassandra_se_impl: public Cassandra_se_interface
ConsistencyLevel
::
type
write_consistency
;
ConsistencyLevel
::
type
read_consistency
;
/* How many times to retry an operation before giving up */
int
thrift_call_retries_to_do
;
/* DDL data */
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)*/
...
...
@@ -68,15 +68,15 @@ class Cassandra_se_impl: public Cassandra_se_interface
/* Insert preparation */
typedef
std
::
map
<
std
::
string
,
std
::
vector
<
Mutation
>
>
ColumnFamilyToMutation
;
typedef
std
::
map
<
std
::
string
,
ColumnFamilyToMutation
>
KeyToCfMutationMap
;
KeyToCfMutationMap
batch_mutation
;
/* Prepare operation here */
int64_t
insert_timestamp
;
std
::
vector
<
Mutation
>*
insert_list
;
/* Resultset we're reading */
std
::
vector
<
KeySlice
>
key_slice_vec
;
std
::
vector
<
KeySlice
>::
iterator
key_slice_it
;
std
::
string
rowkey
;
/* key of the record we're returning now */
SlicePredicate
slice_pred
;
...
...
@@ -84,12 +84,12 @@ class Cassandra_se_impl: public Cassandra_se_interface
bool
get_slices_returned_less
;
bool
get_slice_found_rows
;
public:
Cassandra_se_impl
()
:
cass
(
NULL
),
Cassandra_se_impl
()
:
cass
(
NULL
),
write_consistency
(
ConsistencyLevel
::
ONE
),
read_consistency
(
ConsistencyLevel
::
ONE
),
thrift_call_retries_to_do
(
0
)
{}
virtual
~
Cassandra_se_impl
(){
delete
cass
;
}
/* Connection and DDL checks */
bool
connect
(
const
char
*
host
,
int
port
,
const
char
*
keyspace
);
void
set_column_family
(
const
char
*
cfname
)
{
column_family
.
assign
(
cfname
);
}
...
...
@@ -137,7 +137,7 @@ public:
void
clear_read_columns
();
void
clear_read_all_columns
();
void
add_read_column
(
const
char
*
name
);
/* Reads, MRR scans */
void
new_lookup_keys
();
int
add_lookup_key
(
const
char
*
key
,
size_t
key_len
);
...
...
@@ -164,7 +164,7 @@ private:
/* Non-inherited utility functions: */
int64_t
get_i64_timestamp
();
typedef
bool
(
Cassandra_se_impl
::*
retryable_func_t
)();
bool
try_operation
(
retryable_func_t
func
);
};
...
...
@@ -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
res
=
true
;
keyspace
.
assign
(
keyspace_arg
);
try
{
boost
::
shared_ptr
<
TTransport
>
socket
=
boost
::
shared_ptr
<
TTransport
>
socket
=
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
<
TProtocol
>
p
=
boost
::
shared_ptr
<
TProtocol
>
p
=
boost
::
shared_ptr
<
TBinaryProtocol
>
(
new
TBinaryProtocol
(
tr
));
cass
=
new
CassandraClient
(
p
);
tr
->
open
();
cass
->
set_keyspace
(
keyspace_arg
);
...
...
@@ -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
)
{
write_cons_level
=
(
ConsistencyLevel
::
type
)(
write_cons_level
+
1
);
...
...
@@ -229,7 +229,7 @@ bool Cassandra_se_impl::retryable_setup_ddl_checks()
try
{
cass
->
describe_keyspace
(
ks_def
,
keyspace
);
}
catch
(
NotFoundException
nfe
)
{
print_error
(
"keyspace `%s` not found: %s"
,
keyspace
.
c_str
(),
nfe
.
what
());
return
true
;
...
...
@@ -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
)
{
if
(
column_ddl_it
==
cf_def
.
column_metadata
.
end
())
...
...
@@ -314,7 +314,7 @@ int64_t Cassandra_se_impl::get_i64_timestamp()
int64_t
usec
=
td
.
tv_usec
;
usec
=
usec
/
1000
;
ms
+=
usec
;
return
ms
;
}
...
...
@@ -345,7 +345,7 @@ void Cassandra_se_impl::add_row_deletion(const char *key, int key_len,
{
std
::
string
key_to_delete
;
key_to_delete
.
assign
(
key
,
key_len
);
batch_mutation
[
key_to_delete
]
=
ColumnFamilyToMutation
();
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,
mut
.
deletion
.
__isset
.
timestamp
=
true
;
mut
.
deletion
.
timestamp
=
get_i64_timestamp
();
mut
.
deletion
.
__isset
.
predicate
=
true
;
/*
Attempting to delete columns with SliceRange causes exception with message
"Deletion does not yet support SliceRange predicates".
...
...
@@ -439,7 +439,7 @@ bool Cassandra_se_impl::do_insert()
*/
if
(
batch_mutation
.
empty
())
return
false
;
return
try_operation
(
&
Cassandra_se_impl
::
retryable_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.
*/
...
...
@@ -475,7 +475,7 @@ bool Cassandra_se_impl::retryable_get_slice()
sr
.
finish
=
""
;
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
);
if
(
column_data_vec
.
size
()
==
0
)
...
...
@@ -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
)
{
get_range_slices_param_last_key_as_start_key
=
last_key_as_start_key
;
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)
bool
Cassandra_se_impl
::
retryable_get_range_slices
()
{
bool
last_key_as_start_key
=
get_range_slices_param_last_key_as_start_key
;
ColumnParent
cparent
;
cparent
.
column_family
=
column_family
;
/* SlicePredicate can be used to limit columns we will retrieve */
KeyRange
key_range
;
...
...
@@ -620,7 +620,7 @@ restart:
return
false
;
}
}
/*
(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
...
...
@@ -710,16 +710,16 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call)
res
=
true
;
try
{
if
((
res
=
(
this
->*
func_to_call
)()))
{
/*
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
result). We need to return this to the caller.
*/
n_retries
=
0
;
n_retries
=
0
;
}
}
catch
(
InvalidRequestException
ire
)
{
...
...
@@ -735,7 +735,7 @@ bool Cassandra_se_impl::try_operation(retryable_func_t func_to_call)
print_error
(
"TimedOutException: %s"
,
te
.
what
());
}
catch
(
TException
e
){
/* todo: we may use retry for certain kinds of Thrift errors */
n_retries
=
0
;
n_retries
=
0
;
print_error
(
"Thrift exception: %s"
,
e
.
what
());
}
catch
(...)
{
n_retries
=
0
;
/* Don't retry */
...
...
storage/cassandra/cassandra_se.h
View file @
3f8eaf7e
...
...
@@ -37,7 +37,7 @@ class Cassandra_se_interface
{
public:
Cassandra_se_interface
()
{
err_buffer
[
0
]
=
0
;
}
virtual
~
Cassandra_se_interface
(){};
/* Init */
virtual
bool
connect
(
const
char
*
host
,
int
port
,
const
char
*
keyspace
)
=
0
;
...
...
@@ -45,11 +45,11 @@ public:
/* Settings */
virtual
void
set_consistency_levels
(
ulong
read_cons_level
,
ulong
write_cons_level
)
=
0
;
/* Check underlying DDL */
virtual
bool
setup_ddl_checks
()
=
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
;
virtual
void
get_rowkey_type
(
char
**
name
,
char
**
type
)
=
0
;
virtual
size_t
get_ddl_size
()
=
0
;
...
...
@@ -106,7 +106,7 @@ class Cassandra_status_vars
public:
ulong
row_inserts
;
ulong
row_insert_batches
;
ulong
multiget_reads
;
ulong
multiget_keys_scanned
;
ulong
multiget_rows_read
;
...
...
storage/cassandra/ha_cassandra.cc
View file @
3f8eaf7e
This diff is collapsed.
Click to expand it.
storage/cassandra/ha_cassandra.h
View file @
3f8eaf7e
/*
/*
Copyright (c) 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
...
...
@@ -106,7 +106,7 @@ class ha_cassandra: public handler
/* Used to produce 'wrong column %s at row %lu' warnings */
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
);
int
connect_and_check_options
(
TABLE
*
table_arg
);
public:
...
...
@@ -144,12 +144,12 @@ public:
We are saying that this engine is just statement capable to have
an engine that can only handle statement-based logging. This is
used in testing.
HA_REC_NOT_IN_SEQ
If we don't set it, filesort crashes, because it assumes rowids are
1..8 byte numbers
HA_REC_NOT_IN_SEQ
If we don't set it, filesort crashes, because it assumes rowids are
1..8 byte numbers
*/
return
HA_BINLOG_STMT_CAPABLE
|
HA_REC_NOT_IN_SEQ
;
return
HA_BINLOG_STMT_CAPABLE
|
HA_REC_NOT_IN_SEQ
;
}
...
...
@@ -191,7 +191,7 @@ public:
support indexes.
*/
uint
max_supported_key_length
()
const
{
return
16
*
1024
;
/* just to return something*/
}
int
index_init
(
uint
idx
,
bool
sorted
);
int
index_read_map
(
uchar
*
buf
,
const
uchar
*
key
,
...
...
@@ -211,19 +211,19 @@ public:
virtual
void
start_bulk_insert
(
ha_rows
rows
);
virtual
int
end_bulk_insert
();
virtual
int
reset
();
int
multi_range_read_init
(
RANGE_SEQ_IF
*
seq
,
void
*
seq_init_param
,
uint
n_ranges
,
uint
mode
,
HANDLER_BUFFER
*
buf
);
int
multi_range_read_next
(
range_id_t
*
range_info
);
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
*
flags
,
COST_VECT
*
cost
);
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
);
int
multi_range_read_explain_info
(
uint
mrr_mode
,
char
*
str
,
size_t
size
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment