summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 14:24:41 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 14:24:41 +0300
commit2e12d471eab9db77473ec80637f8d0d2d03bf69f (patch)
treeeea2f8df98e8ccbd28d59b75706f44330fd4407d /sql/item_func.cc
parent61c0df94655f2dc3146456e49f3f51610251e79f (diff)
parentc06845d6f04e092b64c105eb6786056cea2ab593 (diff)
downloadmariadb-git-2e12d471eab9db77473ec80637f8d0d2d03bf69f.tar.gz
Merge 10.2 into 10.3
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 007f63ed90e..d47bc14c1ce 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, 2019, 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
@@ -2616,19 +2616,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 (WSREP(thd))
+ {
+ 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));