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
9cdf5eee
Commit
9cdf5eee
authored
Aug 18, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-431: Cassandra storage engine
- Support "DELETE FROM cassandra_table"
parent
ab281741
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
8 deletions
+44
-8
mysql-test/r/cassandra.result
mysql-test/r/cassandra.result
+3
-0
mysql-test/t/cassandra.test
mysql-test/t/cassandra.test
+5
-0
storage/cassandra/cassandra_se.cc
storage/cassandra/cassandra_se.cc
+22
-0
storage/cassandra/cassandra_se.h
storage/cassandra/cassandra_se.h
+2
-1
storage/cassandra/ha_cassandra.cc
storage/cassandra/ha_cassandra.cc
+12
-7
No files found.
mysql-test/r/cassandra.result
View file @
9cdf5eee
...
...
@@ -22,4 +22,7 @@ select * from t1;
rowkey data1 data2
data1-value 123456
data1-value2 34543
delete from t1;
select * from t1;
rowkey data1 data2
drop table t1;
mysql-test/t/cassandra.test
View file @
9cdf5eee
...
...
@@ -55,6 +55,11 @@ create table t1 (rowkey char(36) primary key, data1 varchar(60), data2 bigint) e
insert
into
t1
values
(
'rowkey10'
,
'data1-value'
,
123456
);
insert
into
t1
values
(
'rowkey11'
,
'data1-value2'
,
34543
);
select
*
from
t1
;
# Check if deletion works
delete
from
t1
;
select
*
from
t1
;
drop
table
t1
;
############################################################################
...
...
storage/cassandra/cassandra_se.cc
View file @
9cdf5eee
...
...
@@ -95,6 +95,8 @@ public:
/* Setup that's necessary before a multi-row read. (todo: use it before point lookups, too) */
void
clear_read_columns
();
void
add_read_column
(
const
char
*
name
);
bool
truncate
();
};
...
...
@@ -398,3 +400,23 @@ void Cassandra_se_impl::add_read_column(const char *name_arg)
slice_pred
.
column_names
.
push_back
(
name
);
}
bool
Cassandra_se_impl
::
truncate
()
{
bool
res
=
true
;
try
{
cass
->
truncate
(
column_family
);
res
=
false
;
}
catch
(
InvalidRequestException
ire
)
{
print_error
(
"%s [%s]"
,
ire
.
what
(),
ire
.
why
.
c_str
());
}
catch
(
UnavailableException
ue
)
{
print_error
(
"UnavailableException: %s"
,
ue
.
what
());
}
catch
(
TimedOutException
te
)
{
print_error
(
"TimedOutException: %s"
,
te
.
what
());
}
return
res
;
}
storage/cassandra/cassandra_se.h
View file @
9cdf5eee
...
...
@@ -44,7 +44,8 @@ public:
/* read_set setup */
virtual
void
clear_read_columns
()
=
0
;
virtual
void
add_read_column
(
const
char
*
name
)
=
0
;
virtual
bool
truncate
()
=
0
;
/* Passing error messages up to ha_cassandra */
char
err_buffer
[
512
];
const
char
*
error_str
()
{
return
err_buffer
;
}
...
...
storage/cassandra/ha_cassandra.cc
View file @
9cdf5eee
...
...
@@ -746,6 +746,18 @@ int ha_cassandra::rnd_next(uchar *buf)
DBUG_RETURN
(
rc
);
}
int
ha_cassandra
::
delete_all_rows
()
{
bool
bres
;
DBUG_ENTER
(
"ha_cassandra::delete_all_rows"
);
bres
=
se
->
truncate
();
DBUG_RETURN
(
bres
?
HA_ERR_INTERNAL_ERROR
:
0
);
}
/////////////////////////////////////////////////////////////////////////////
// Dummy implementations start
/////////////////////////////////////////////////////////////////////////////
...
...
@@ -861,13 +873,6 @@ int ha_cassandra::delete_row(const uchar *buf)
}
int
ha_cassandra
::
delete_all_rows
()
{
DBUG_ENTER
(
"ha_cassandra::delete_all_rows"
);
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
/**
check_if_incompatible_data() called if ALTER TABLE can't detect otherwise
if new and old definition are compatible
...
...
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