Skip to content

Commit 8634f7e

Browse files
committed
Merge branch '5.5' into 10.0
2 parents f16d4d4 + b0fd06a commit 8634f7e

File tree

8 files changed

+43
-56
lines changed

8 files changed

+43
-56
lines changed

cmake/zlib.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ ENDMACRO()
3434

3535
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
3636

37-
# For NDBCLUSTER: Use bundled zlib by default
38-
IF (NOT WITH_ZLIB)
39-
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
40-
ENDIF()
41-
4237
IF(WITH_ZLIB STREQUAL "bundled")
4338
MYSQL_USE_BUNDLED_ZLIB()
4439
ELSE()

mysql-test/r/read_only.result

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,23 @@ flush privileges;
163163
drop database mysqltest_db1;
164164
set global read_only= @start_read_only;
165165
#
166+
# MDEV-16987 - ALTER DATABASE possible in read-only mode
167+
#
168+
GRANT ALTER ON test1.* TO user1@localhost;
169+
CREATE DATABASE test1;
170+
SET GLOBAL read_only=1;
171+
ALTER DATABASE test1 CHARACTER SET utf8;
172+
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
173+
SET GLOBAL read_only=0;
174+
DROP DATABASE test1;
175+
DROP USER user1@localhost;
176+
USE test;
177+
# End of 5.5 tests
178+
#
166179
# WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
167180
#
168181
#
169182
# Test interaction with read_only system variable.
170-
DROP TABLE IF EXISTS t1;
171183
CREATE TABLE t1(a INT);
172184
INSERT INTO t1 VALUES (1), (2);
173185
CREATE USER user1;
@@ -199,3 +211,4 @@ COMMIT;
199211
DROP USER user1;
200212
SET GLOBAL read_only= 0;
201213
DROP TABLE t1;
214+
# End of 10.0 tests

mysql-test/t/read_only.test

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,22 @@ flush privileges;
307307
drop database mysqltest_db1;
308308
set global read_only= @start_read_only;
309309

310+
--echo #
311+
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
312+
--echo #
313+
GRANT ALTER ON test1.* TO user1@localhost;
314+
CREATE DATABASE test1;
315+
SET GLOBAL read_only=1;
316+
change_user user1;
317+
--error ER_OPTION_PREVENTS_STATEMENT
318+
ALTER DATABASE test1 CHARACTER SET utf8;
319+
change_user root;
320+
SET GLOBAL read_only=0;
321+
DROP DATABASE test1;
322+
DROP USER user1@localhost;
323+
USE test;
324+
325+
--echo # End of 5.5 tests
310326

311327
--echo #
312328
--echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
@@ -315,10 +331,6 @@ set global read_only= @start_read_only;
315331
--echo #
316332
--echo # Test interaction with read_only system variable.
317333

318-
--disable_warnings
319-
DROP TABLE IF EXISTS t1;
320-
--enable_warnings
321-
322334
CREATE TABLE t1(a INT);
323335
INSERT INTO t1 VALUES (1), (2);
324336

@@ -369,3 +381,4 @@ DROP TABLE t1;
369381
# Wait till all disconnects are completed
370382
--source include/wait_until_count_sessions.inc
371383

384+
--echo # End of 10.0 tests

sql/sql_parse.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
10451045
DBUG_RETURN(FALSE);
10461046

10471047
if (lex->sql_command == SQLCOM_CREATE_DB ||
1048+
lex->sql_command == SQLCOM_ALTER_DB ||
10481049
lex->sql_command == SQLCOM_DROP_DB)
10491050
DBUG_RETURN(TRUE);
10501051

unittest/mysys/lf-t.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ pthread_handler_t test_lf_pinbox(void *arg)
4848
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
4949
}
5050
lf_pinbox_put_pins(pins);
51-
pthread_mutex_lock(&mutex);
52-
if (!--running_threads) pthread_cond_signal(&cond);
53-
pthread_mutex_unlock(&mutex);
5451

5552
if (with_my_thread_init)
5653
my_thread_end();
@@ -105,7 +102,6 @@ pthread_handler_t test_lf_alloc(void *arg)
105102
bad|= lf_allocator.mallocs - lf_alloc_pool_count(&lf_allocator);
106103
#endif
107104
}
108-
if (!--running_threads) pthread_cond_signal(&cond);
109105
pthread_mutex_unlock(&mutex);
110106

111107
if (with_my_thread_init)
@@ -159,7 +155,6 @@ pthread_handler_t test_lf_hash(void *arg)
159155
lf_hash.size, inserts);
160156
bad|= lf_hash.count;
161157
}
162-
if (!--running_threads) pthread_cond_signal(&cond);
163158
pthread_mutex_unlock(&mutex);
164159
if (with_my_thread_init)
165160
my_thread_end();

unittest/mysys/my_atomic-t.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ pthread_handler_t test_atomic_add(void *arg)
3535
my_atomic_add32(&bad, -x);
3636
my_atomic_rwlock_wrunlock(&rwl);
3737
}
38-
pthread_mutex_lock(&mutex);
39-
if (!--running_threads) pthread_cond_signal(&cond);
40-
pthread_mutex_unlock(&mutex);
4138
return 0;
4239
}
4340

@@ -58,13 +55,6 @@ pthread_handler_t test_atomic_add64(void *arg)
5855
my_atomic_add64(&a64, -x);
5956
my_atomic_rwlock_wrunlock(&rwl);
6057
}
61-
pthread_mutex_lock(&mutex);
62-
if (!--running_threads)
63-
{
64-
bad= (a64 != 0);
65-
pthread_cond_signal(&cond);
66-
}
67-
pthread_mutex_unlock(&mutex);
6858
return 0;
6959
}
7060

@@ -108,9 +98,6 @@ pthread_handler_t test_atomic_fas(void *arg)
10898
my_atomic_add32(&bad, -x);
10999
my_atomic_rwlock_wrunlock(&rwl);
110100

111-
pthread_mutex_lock(&mutex);
112-
if (!--running_threads) pthread_cond_signal(&cond);
113-
pthread_mutex_unlock(&mutex);
114101
return 0;
115102
}
116103

@@ -140,9 +127,6 @@ pthread_handler_t test_atomic_cas(void *arg)
140127
my_atomic_rwlock_wrunlock(&rwl);
141128
} while (!ok) ;
142129
}
143-
pthread_mutex_lock(&mutex);
144-
if (!--running_threads) pthread_cond_signal(&cond);
145-
pthread_mutex_unlock(&mutex);
146130
return 0;
147131
}
148132

@@ -178,6 +162,7 @@ void do_tests()
178162
}
179163
a64=0;
180164
test_concurrently("my_atomic_add64", test_atomic_add64, THREADS, CYCLES);
165+
bad= (a64 != 0);
181166

182167
my_atomic_rwlock_destroy(&rwl);
183168
}

unittest/mysys/thr_template.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,34 @@
2020
#include <tap.h>
2121

2222
volatile uint32 bad;
23-
pthread_attr_t thr_attr;
2423
pthread_mutex_t mutex;
25-
pthread_cond_t cond;
26-
uint running_threads;
2724

2825
void do_tests();
2926

3027
void test_concurrently(const char *test, pthread_handler handler, int n, int m)
3128
{
32-
pthread_t t;
29+
pthread_t *threads= malloc(n * sizeof(pthread_t));
30+
int i;
3331
ulonglong now= my_interval_timer();
3432

33+
assert(threads);
3534
bad= 0;
3635

3736
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
38-
for (running_threads= n ; n ; n--)
37+
for (i= n; i; i--)
3938
{
40-
if (pthread_create(&t, &thr_attr, handler, &m) != 0)
39+
if (pthread_create(&threads[i], 0, handler, &m) != 0)
4140
{
4241
diag("Could not create thread");
4342
abort();
4443
}
4544
}
46-
pthread_mutex_lock(&mutex);
47-
while (running_threads)
48-
pthread_cond_wait(&cond, &mutex);
49-
pthread_mutex_unlock(&mutex);
45+
46+
for (i= n; i; i--)
47+
pthread_join(threads[i], 0);
5048

5149
now= my_interval_timer() - now;
50+
free(threads);
5251
ok(!bad, "tested %s in %g secs (%d)", test, ((double)now)/1e9, bad);
5352
}
5453

@@ -60,9 +59,6 @@ int main(int argc __attribute__((unused)), char **argv)
6059
DBUG_SET_INITIAL(argv[1]);
6160

6261
pthread_mutex_init(&mutex, 0);
63-
pthread_cond_init(&cond, 0);
64-
pthread_attr_init(&thr_attr);
65-
pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
6662

6763
#ifdef MY_ATOMIC_MODE_RWLOCKS
6864
#if defined(HPUX11) || defined(__POWERPC__) /* showed to be very slow (scheduler-related) */
@@ -79,16 +75,7 @@ int main(int argc __attribute__((unused)), char **argv)
7975

8076
do_tests();
8177

82-
/*
83-
workaround until we know why it crashes randomly on some machine
84-
(BUG#22320).
85-
*/
86-
#ifdef NOT_USED
87-
sleep(2);
88-
#endif
8978
pthread_mutex_destroy(&mutex);
90-
pthread_cond_destroy(&cond);
91-
pthread_attr_destroy(&thr_attr);
9279
my_end(0);
9380
return exit_status();
9481
}

unittest/mysys/waiting_threads-t.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ pthread_handler_t test_wt(void *arg)
136136
pthread_mutex_unlock(&lock);
137137
pthread_mutex_unlock(& thds[id].lock);
138138
wt_thd_destroy(& thds[id].thd);
139-
140-
if (!--running_threads) /* now, signal when everybody is done with deinit */
141-
pthread_cond_signal(&cond);
142139
pthread_mutex_unlock(&mutex);
140+
143141
DBUG_PRINT("wt", ("exiting"));
144142
my_thread_end();
145143
return 0;

0 commit comments

Comments
 (0)