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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
70cb38cf
Commit
70cb38cf
authored
Jun 06, 2019
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inital commit of Clustrix backend plugin.
parent
e0e5d8c5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1848 additions
and
0 deletions
+1848
-0
storage/clustrixdb/CMakeLists.txt
storage/clustrixdb/CMakeLists.txt
+24
-0
storage/clustrixdb/clustrix_connection.cc
storage/clustrixdb/clustrix_connection.cc
+589
-0
storage/clustrixdb/clustrix_connection.h
storage/clustrixdb/clustrix_connection.h
+100
-0
storage/clustrixdb/ha_clustrixdb.cc
storage/clustrixdb/ha_clustrixdb.cc
+1011
-0
storage/clustrixdb/ha_clustrixdb.h
storage/clustrixdb/ha_clustrixdb.h
+124
-0
No files found.
storage/clustrixdb/CMakeLists.txt
0 → 100644
View file @
70cb38cf
#*****************************************************************************
# Copyright (c) 2019, MariaDB Corporation.
#****************************************************************************/
IF
(
MSVC
)
# Temporarily disable "conversion from size_t .."
IF
(
CMAKE_SIZEOF_VOID_P EQUAL 8
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/wd4267"
)
ENDIF
()
ENDIF
()
SET
(
CLUSTRIXDB_PLUGIN_STATIC
"clustrixdb"
)
SET
(
CLUSTRIXDB_PLUGIN_DYNAMIC
"ha_clustrixdb"
)
SET
(
CLUSTRIXDB_SOURCES ha_clustrixdb.cc clustrix_connection.cc
)
MYSQL_ADD_PLUGIN
(
clustrixdb
${
CLUSTRIXDB_SOURCES
}
STORAGE_ENGINE
)
IF
(
MSVC
)
IF
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
ADD_CUSTOM_COMMAND
(
TARGET clustrixdb
POST_BUILD
COMMAND if not exist ..\\..\\sql\\lib mkdir ..\\..\\sql\\lib\\plugin
COMMAND copy Debug\\ha_clustrixdb.dll ..\\..\\sql\\lib\\plugin\\ha_clustrixdb.dll
)
ENDIF
()
ENDIF
()
storage/clustrixdb/clustrix_connection.cc
0 → 100644
View file @
70cb38cf
This diff is collapsed.
Click to expand it.
storage/clustrixdb/clustrix_connection.h
0 → 100644
View file @
70cb38cf
/*****************************************************************************
Copyright (c) 2019, MariaDB Corporation.
*****************************************************************************/
#ifndef _clustrix_connection_h
#define _clustrix_connection_h
#ifdef USE_PRAGMA_INTERFACE
#pragma interface
/* gcc class implementation */
#endif
#define MYSQL_SERVER 1
#include "my_global.h"
#include "m_string.h"
#include "mysql.h"
#include "sql_common.h"
#include "my_base.h"
#include "mysqld_error.h"
#include "my_bitmap.h"
#include "handler.h"
#define CLUSTRIX_SERVER_REQUEST 30
class
clustrix_connection
{
private:
# define COMMAND_BUFFER_SIZE_INCREMENT 1024
# define COMMAND_BUFFER_SIZE_INCREMENT_BITS 10
MYSQL
clustrix_net
;
uchar
*
command_buffer
;
size_t
command_buffer_length
;
size_t
command_length
;
uchar
*
reply_buffer
;
size_t
reply_length
;
public:
ulonglong
last_insert_id
;
clustrix_connection
()
:
command_buffer
(
NULL
),
command_buffer_length
(
0
),
command_length
(
0
)
{
memset
(
&
clustrix_net
,
0
,
sizeof
(
MYSQL
));
}
~
clustrix_connection
()
{
if
(
is_connected
())
disconnect
(
TRUE
);
if
(
command_buffer
)
my_free
(
command_buffer
);
}
inline
bool
is_connected
()
{
return
clustrix_net
.
net
.
vio
;
}
int
connect
();
void
disconnect
(
bool
is_destructor
=
FALSE
);
int
begin_trans
();
int
commit_trans
();
int
rollback_trans
();
int
create_table
(
char
*
stmt
);
int
delete_table
(
char
*
stmt
);
int
write_row
(
ulonglong
clustrix_table_oid
,
uchar
*
packed_row
,
size_t
packed_size
);
int
key_delete
(
ulonglong
clustrix_table_oid
,
uchar
*
packed_key
,
size_t
packed_key_length
);
int
key_read
(
ulonglong
clustrix_table_oid
,
uint
index
,
MY_BITMAP
*
read_set
,
uchar
*
packed_key
,
ulong
packed_key_length
,
uchar
**
rowdata
,
ulong
*
rowdata_length
);
enum
sort_order
{
SORT_NONE
=
0
,
SORT_ASC
=
1
,
SORT_DESC
=
2
};
int
scan_init
(
ulonglong
clustrix_table_oid
,
uint
index
,
enum
sort_order
sort
,
MY_BITMAP
*
read_set
,
ulonglong
*
scan_refid
);
int
scan_next
(
ulonglong
scan_refid
,
uchar
**
rowdata
,
ulong
*
rowdata_length
);
int
scan_end
(
ulonglong
scan_refid
);
int
populate_table_list
(
LEX_CSTRING
*
db
,
handlerton
::
discovered_list
*
result
);
int
discover_table_details
(
LEX_CSTRING
*
db
,
LEX_CSTRING
*
name
,
THD
*
thd
,
TABLE_SHARE
*
share
);
private:
int
expand_command_buffer
(
size_t
add_length
);
int
add_command_operand_uchar
(
uchar
value
);
int
add_command_operand_uint
(
uint
value
);
int
add_command_operand_ulonglong
(
ulonglong
value
);
int
add_command_operand_lcb
(
ulonglong
value
);
int
add_command_operand_str
(
const
uchar
*
str
,
size_t
length
);
int
add_command_operand_lex_string
(
LEX_CSTRING
str
);
int
add_command_operand_bitmap
(
MY_BITMAP
*
bitmap
);
int
send_command
();
int
read_query_response
();
};
#endif // _clustrix_connection_h
storage/clustrixdb/ha_clustrixdb.cc
0 → 100644
View file @
70cb38cf
This diff is collapsed.
Click to expand it.
storage/clustrixdb/ha_clustrixdb.h
0 → 100644
View file @
70cb38cf
/*****************************************************************************
Copyright (c) 2019, MariaDB Corporation.
*****************************************************************************/
#ifndef _ha_clustrixdb_h
#define _ha_clustrixdb_h
#ifdef USE_PRAGMA_INTERFACE
#pragma interface
/* gcc class implementation */
#endif
#define MYSQL_SERVER 1
#include "clustrix_connection.h"
#include "my_bitmap.h"
#include "table.h"
#include "rpl_rli.h"
#include "handler.h"
#include "sql_class.h"
#include "sql_show.h"
#include "mysql.h"
#include "../../sql/rpl_record.h"
class
ha_clustrixdb
;
class
st_clustrixdb_trx
{
public:
THD
*
thd
;
clustrix_connection
*
clustrix_net
;
//query_id_t query_id;
//MEM_ROOT mem_root; /* Memory allocated for the executing transaction */
bool
has_transaction
;
st_clustrixdb_trx
(
THD
*
trx_thd
);
~
st_clustrixdb_trx
();
int
net_init
();
int
begin_trans
();
};
class
ha_clustrixdb
:
public
handler
{
private:
# define CLUSTRIXDB_ROW_LIMIT 1024
ulonglong
clustrix_table_oid
;
rpl_group_info
*
rgi
;
Relay_log_info
*
rli
;
RPL_TABLE_LIST
*
rpl_table_list
;
Field
*
auto_inc_field
;
ulonglong
auto_inc_value
;
bool
has_hidden_key
;
ulonglong
last_hidden_key
;
ulonglong
scan_refid
;
bool
is_scan
;
MY_BITMAP
scan_fields
;
public:
ha_clustrixdb
(
handlerton
*
hton
,
TABLE_SHARE
*
table_arg
);
~
ha_clustrixdb
();
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
info
);
int
delete_table
(
const
char
*
name
);
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
);
int
close
(
void
);
int
reset
();
int
write_row
(
uchar
*
buf
);
// start_bulk_update exec_bulk_update
int
update_row
(
const
uchar
*
old_data
,
const
uchar
*
new_data
);
// start_bulk_delete exec_bulk_delete
int
delete_row
(
const
uchar
*
buf
);
Table_flags
table_flags
(
void
)
const
;
ulong
index_flags
(
uint
idx
,
uint
part
,
bool
all_parts
)
const
;
uint
max_supported_keys
()
const
{
return
MAX_KEY
;
}
ha_rows
records
();
ha_rows
records_in_range
(
uint
inx
,
key_range
*
min_key
,
key_range
*
max_key
);
int
info
(
uint
flag
);
// see my_base.h for full description
// multi_read_range
// read_range
int
index_init
(
uint
idx
,
bool
sorted
);
int
index_read
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
);
int
index_first
(
uchar
*
buf
);
int
index_prev
(
uchar
*
buf
);
int
index_last
(
uchar
*
buf
);
int
index_next
(
uchar
*
buf
);
//int index_next_same(uchar *buf, const uchar *key, uint keylen);
int
index_end
();
int
rnd_init
(
bool
scan
);
int
rnd_next
(
uchar
*
buf
);
int
rnd_pos
(
uchar
*
buf
,
uchar
*
pos
);
int
rnd_end
();
void
position
(
const
uchar
*
record
);
uint
lock_count
(
void
)
const
;
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
uint8
table_cache_type
()
{
return
(
HA_CACHE_TBL_NOCACHE
);
}
const
COND
*
cond_push
(
const
COND
*
cond
);
void
cond_pop
();
int
info_push
(
uint
info_type
,
void
*
info
);
private:
st_clustrixdb_trx
*
get_trx
(
THD
*
thd
,
int
*
error_code
);
void
add_current_table_to_rpl_table_list
();
void
remove_current_table_from_rpl_table_list
();
void
build_key_packed_row
(
uint
index
,
uchar
*
packed_key
,
size_t
*
packed_key_len
);
};
#endif // _ha_clustrixdb_h
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