summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-09-23 20:26:35 +0200
committerSergei Golubchik <serg@mariadb.org>2018-09-24 11:46:08 +0200
commit5ae8fce50bb5cbd7916acd6b03bd699f79c10616 (patch)
tree6291ec25e408ea225531e8b79a4f4fd7f3a81329 /storage
parent76098f45b8b1f2224eb25cf5d94450c6f4a1414c (diff)
parent1fc5a6f30c3a9c047dcf9a36b00026d98f286f6b (diff)
downloadmariadb-git-5ae8fce50bb5cbd7916acd6b03bd699f79c10616.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'storage')
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes_part.result48
-rw-r--r--storage/tokudb/ha_tokudb.cc12
-rw-r--r--storage/tokudb/ha_tokudb.h2
-rw-r--r--storage/tokudb/hatoku_defines.h16
4 files changed, 64 insertions, 14 deletions
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/r/spider_fixes_part.result
index d2367af9bbd..d1a28d64a04 100644
--- a/storage/spider/mysql-test/spider/r/spider_fixes_part.result
+++ b/storage/spider/mysql-test/spider/r/spider_fixes_part.result
@@ -263,6 +263,54 @@ a b c d e f
51ECF2C0CD3C48D99C91792E99D3C1A0 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:29 510411 0
093B37A93A534DF883787AF5F6799674 996C7F14989D480589A553717D735E3E 51041110620302 2018-08-02 13:48:30 510411 0
+Test ORDER BY with LIMIT and OFFSET
+CREATE TABLE ta_ob (
+a VARCHAR(50) NOT NULL,
+b VARCHAR(50) NULL DEFAULT NULL,
+c VARCHAR(100) NULL DEFAULT NULL,
+d DATETIME(0) NULL DEFAULT NULL,
+e INT(11) NOT NULL,
+f INT(10) NULL DEFAULT NULL,
+PRIMARY KEY (a, e)
+) ENGINE=Spider COMMENT='database "auto_test_remote", table "ta_ob"'
+ PARTITION BY LIST COLUMNS (e) PARTITIONS 1
+(PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"')
+INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733',
+'6CFED89FF6A84C7AA55C3C432663D094',
+'51041110620304', '2018-08-02 13:41:13',
+510411, 1);
+INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD',
+'879DC2A0B6AC46D9A62E8EA47E2970F2',
+'51041110620301', NULL,
+510411, 0);
+INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0',
+'017B8A460DBC444682B791305EF75356',
+'51041110620308', '2018-08-02 13:48:29',
+510411, 0);
+INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674',
+'996C7F14989D480589A553717D735E3E',
+'51041110620302', '2018-08-02 13:48:30',
+510411, 0);
+INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583',
+'017B8A460DBC444682B791305EF75356',
+'51041110620308', '2018-08-02 13:48:28',
+510411, 0);
+INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B',
+'821E71E6ABB4404EBAA349BB681089F8',
+'51041110620310', '2018-08-02 13:48:27',
+510411, 0);
+INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70',
+'821E71E6ABB4404EBAA349BB681089F8',
+'51041110620310', '2018-08-02 13:48:28',
+510411, 0);
+SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1;
+a b c d e f
+56E59BC4BDC143868D4A219C2D07A24B 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:27 510411 0
+53F5266FB069499AB6234755CACA2583 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:28 510411 0
+56B68DA68D6D4A04A08B453D09AD7B70 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:28 510411 0
+51ECF2C0CD3C48D99C91792E99D3C1A0 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:29 510411 0
+093B37A93A534DF883787AF5F6799674 996C7F14989D480589A553717D735E3E 51041110620302 2018-08-02 13:48:30 510411 0
+
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index d5b4adcd745..1f626727e7b 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -48,7 +48,7 @@ static inline uint get_ext_key_parts(const KEY *key) {
#endif // defined(TOKU_INCLUDE_EXTENDED_KEYS) && TOKU_INCLUDE_EXTENDED_KEYS
std::unordered_map<std::string, TOKUDB_SHARE*> TOKUDB_SHARE::_open_tables;
-tokudb::thread::mutex_t TOKUDB_SHARE::_open_tables_mutex;
+tokudb::thread::mutex_t* TOKUDB_SHARE::_open_tables_mutex;
static const char* ha_tokudb_exts[] = {
ha_tokudb_ext,
@@ -154,6 +154,7 @@ static void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) {
void TOKUDB_SHARE::static_init() {
assert_always(_open_tables.size() == 0);
+ _open_tables_mutex = new tokudb::thread::mutex_t();
}
void TOKUDB_SHARE::static_destroy() {
for (auto it = _open_tables.cbegin(); it != _open_tables.cend(); it++) {
@@ -164,6 +165,7 @@ void TOKUDB_SHARE::static_destroy() {
}
_open_tables.clear();
assert_always(_open_tables.size() == 0);
+ delete _open_tables_mutex;
}
const char* TOKUDB_SHARE::get_state_string(share_state_t state) {
static const char* state_string[] = {
@@ -218,7 +220,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name,
THR_LOCK_DATA* data,
bool create_new) {
std::string find_table_name(table_name);
- mutex_t_lock(_open_tables_mutex);
+ mutex_t_lock(*_open_tables_mutex);
auto it = _open_tables.find(find_table_name);
TOKUDB_SHARE *share = nullptr;
if (it != _open_tables.end()) {
@@ -251,7 +253,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name,
thr_lock_data_init(&(share->_thr_lock), data, NULL);
exit:
- mutex_t_unlock(_open_tables_mutex);
+ mutex_t_unlock(*_open_tables_mutex);
return share;
}
void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) {
@@ -262,12 +264,12 @@ void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) {
get_state_string(share->_state),
share->_use_count);
- mutex_t_lock(_open_tables_mutex);
+ mutex_t_lock(*_open_tables_mutex);
size_t n = _open_tables.erase(std::string(share->full_table_name()));
assert_always(n == 1);
share->destroy();
delete share;
- mutex_t_unlock(_open_tables_mutex);
+ mutex_t_unlock(*_open_tables_mutex);
}
TOKUDB_SHARE::share_state_t TOKUDB_SHARE::addref() {
TOKUDB_SHARE_TRACE_FOR_FLAGS((TOKUDB_DEBUG_ENTER & TOKUDB_DEBUG_SHARE),
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index 6f592617b76..e322c3de18e 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -274,7 +274,7 @@ public:
private:
static std::unordered_map<std::string, TOKUDB_SHARE*> _open_tables;
- static tokudb::thread::mutex_t _open_tables_mutex;
+ static tokudb::thread::mutex_t* _open_tables_mutex;
//*********************************
// Spans open-close-open
diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h
index ced3254199f..ce3d5202915 100644
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@ -290,23 +290,23 @@ inline uint tokudb_uint3korr(const uchar *a) {
typedef unsigned int pfs_key_t;
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_MUTEX_INTERFACE)
-#define mutex_t_lock(M) M.lock(__FILE__, __LINE__)
+#define mutex_t_lock(M) (M).lock(__FILE__, __LINE__)
#else // SAFE_MUTEX || HAVE_PSI_MUTEX_INTERFACE
-#define mutex_t_lock(M) M.lock()
+#define mutex_t_lock(M) (M).lock()
#endif // SAFE_MUTEX || HAVE_PSI_MUTEX_INTERFACE
#if defined(SAFE_MUTEX)
-#define mutex_t_unlock(M) M.unlock(__FILE__, __LINE__)
+#define mutex_t_unlock(M) (M).unlock(__FILE__, __LINE__)
#else // SAFE_MUTEX
-#define mutex_t_unlock(M) M.unlock()
+#define mutex_t_unlock(M) (M).unlock()
#endif // SAFE_MUTEX
#if defined(HAVE_PSI_RWLOCK_INTERFACE)
-#define rwlock_t_lock_read(M) M.lock_read(__FILE__, __LINE__)
-#define rwlock_t_lock_write(M) M.lock_write(__FILE__, __LINE__)
+#define rwlock_t_lock_read(M) (M).lock_read(__FILE__, __LINE__)
+#define rwlock_t_lock_write(M) (M).lock_write(__FILE__, __LINE__)
#else // HAVE_PSI_RWLOCK_INTERFACE
-#define rwlock_t_lock_read(M) M.lock_read()
-#define rwlock_t_lock_write(M) M.lock_write()
+#define rwlock_t_lock_read(M) (M).lock_read()
+#define rwlock_t_lock_write(M) (M).lock_write()
#endif // HAVE_PSI_RWLOCK_INTERFACE
#endif // _HATOKU_DEFINES_H