summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 13:28:13 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 13:28:13 +0300
commitc06845d6f04e092b64c105eb6786056cea2ab593 (patch)
treecfd3f3abc32ab96fb918d3c00ffc68f072ca29bc /sql/item_func.cc
parent2c5067b6890974d0df335a833ed7a4e4c6ced183 (diff)
parentedbdfc2f995eb47ba49235195aca00888aeacbc4 (diff)
downloadmariadb-git-c06845d6f04e092b64c105eb6786056cea2ab593.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 5a4c7aeab3e..a2409de08ca 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2640,19 +2640,20 @@ void Item_func_rand::seed_random(Item *arg)
TODO: do not do reinit 'rand' for every execute of PS/SP if
args[0] is a constant.
*/
- uint32 tmp;
+ uint32 tmp= (uint32) arg->val_int();
#ifdef WITH_WSREP
- THD *thd= current_thd;
- if (WSREP(thd))
+ if (WSREP_ON)
{
- if (thd->wsrep_exec_mode==REPL_RECV)
- tmp= thd->wsrep_rand;
- else
- tmp= thd->wsrep_rand= (uint32) arg->val_int();
- }
- else
+ THD *thd= current_thd;
+ if (thd->variables.wsrep_on)
+ {
+ if (thd->wsrep_exec_mode==REPL_RECV)
+ tmp= thd->wsrep_rand;
+ else
+ thd->wsrep_rand= tmp;
+ }
+ }
#endif /* WITH_WSREP */
- tmp= (uint32) arg->val_int();
my_rnd_init(rand, (uint32) (tmp*0x10001L+55555555L),
(uint32) (tmp*0x10000001L));