Skip to content

Commit b489d5f

Browse files
committed
Merge 10.6 into 10.11
2 parents ccf2886 + a1bba0e commit b489d5f

File tree

7 files changed

+65
-43
lines changed

7 files changed

+65
-43
lines changed

sql/item.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,12 +2029,12 @@ class Item :public Value_source,
20292029
/**
20302030
TIME or DATETIME precision of the item: 0..6
20312031
*/
2032-
uint time_precision(THD *thd)
2032+
decimal_digits_t time_precision(THD *thd)
20332033
{
20342034
return const_item() ? type_handler()->Item_time_precision(thd, this) :
20352035
MY_MIN(decimals, TIME_SECOND_PART_DIGITS);
20362036
}
2037-
uint datetime_precision(THD *thd)
2037+
decimal_digits_t datetime_precision(THD *thd)
20382038
{
20392039
return const_item() ? type_handler()->Item_datetime_precision(thd, this) :
20402040
MY_MIN(decimals, TIME_SECOND_PART_DIGITS);

sql/item_func.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,8 @@ class Item_func_numhybrid: public Item_func_hybrid_field_type
11181118
inline void fix_decimals()
11191119
{
11201120
DBUG_ASSERT(result_type() == DECIMAL_RESULT);
1121-
if (decimals == NOT_FIXED_DEC)
1122-
set_if_smaller(decimals, max_length - 1);
1121+
if (decimals == NOT_FIXED_DEC && decimals >= max_length)
1122+
decimals= decimal_digits_t(max_length - 1);
11231123
}
11241124

11251125
public:
@@ -1507,7 +1507,8 @@ class Item_func_unsigned :public Item_func_signed
15071507
{
15081508
return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this);
15091509
}
1510-
decimal_digits_t decimal_precision() const override { return max_length; }
1510+
decimal_digits_t decimal_precision() const override
1511+
{ return decimal_digits_t(max_length); }
15111512
void print(String *str, enum_query_type query_type) override;
15121513
Item *do_get_copy(THD *thd) const override
15131514
{ return get_item_copy<Item_func_unsigned>(thd, this); }
@@ -1518,7 +1519,8 @@ class Item_decimal_typecast :public Item_func
15181519
{
15191520
my_decimal decimal_value;
15201521
public:
1521-
Item_decimal_typecast(THD *thd, Item *a, uint len, decimal_digits_t dec)
1522+
Item_decimal_typecast(THD *thd, Item *a,
1523+
decimal_digits_t len, decimal_digits_t dec)
15221524
:Item_func(thd, a)
15231525
{
15241526
decimals= dec;

sql/item_timefunc.h

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ class Item_func_seconds_hybrid: public Item_func_numhybrid
549549
public:
550550
Item_func_seconds_hybrid(THD *thd): Item_func_numhybrid(thd) {}
551551
Item_func_seconds_hybrid(THD *thd, Item *a): Item_func_numhybrid(thd, a) {}
552-
void fix_length_and_dec_generic(uint dec)
552+
void fix_length_and_dec_generic(decimal_digits_t dec)
553553
{
554554
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
555555
decimals= dec;
@@ -724,7 +724,8 @@ class Item_func_curtime :public Item_timefunc
724724
MYSQL_TIME ltime;
725725
query_id_t last_query_id;
726726
public:
727-
Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0)
727+
Item_func_curtime(THD *thd, decimal_digits_t dec):
728+
Item_timefunc(thd), last_query_id(0)
728729
{ decimals= dec; }
729730
bool fix_fields(THD *, Item **) override;
730731
bool fix_length_and_dec(THD *thd) override
@@ -747,7 +748,8 @@ class Item_func_curtime :public Item_timefunc
747748
class Item_func_curtime_local :public Item_func_curtime
748749
{
749750
public:
750-
Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
751+
Item_func_curtime_local(THD *thd, decimal_digits_t dec):
752+
Item_func_curtime(thd, dec) {}
751753
LEX_CSTRING func_name_cstring() const override
752754
{
753755
static LEX_CSTRING name= {STRING_WITH_LEN("curtime") };
@@ -762,7 +764,8 @@ class Item_func_curtime_local :public Item_func_curtime
762764
class Item_func_curtime_utc :public Item_func_curtime
763765
{
764766
public:
765-
Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
767+
Item_func_curtime_utc(THD *thd, decimal_digits_t dec):
768+
Item_func_curtime(thd, dec) {}
766769
LEX_CSTRING func_name_cstring() const override
767770
{
768771
static LEX_CSTRING name= {STRING_WITH_LEN("utc_time") };
@@ -828,7 +831,8 @@ class Item_func_now :public Item_datetimefunc
828831
MYSQL_TIME ltime;
829832
query_id_t last_query_id;
830833
public:
831-
Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0)
834+
Item_func_now(THD *thd, decimal_digits_t dec):
835+
Item_datetimefunc(thd), last_query_id(0)
832836
{ decimals= dec; }
833837
bool fix_fields(THD *, Item **) override;
834838
bool fix_length_and_dec(THD *thd) override
@@ -850,7 +854,8 @@ class Item_func_now :public Item_datetimefunc
850854
class Item_func_now_local :public Item_func_now
851855
{
852856
public:
853-
Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
857+
Item_func_now_local(THD *thd, decimal_digits_t dec):
858+
Item_func_now(thd, dec) {}
854859
LEX_CSTRING func_name_cstring() const override
855860
{
856861
static LEX_CSTRING name= {STRING_WITH_LEN("current_timestamp") };
@@ -867,7 +872,7 @@ class Item_func_now_local :public Item_func_now
867872
class Item_func_now_utc :public Item_func_now
868873
{
869874
public:
870-
Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {}
875+
Item_func_now_utc(THD *thd, decimal_digits_t dec): Item_func_now(thd, dec) {}
871876
LEX_CSTRING func_name_cstring() const override
872877
{
873878
static LEX_CSTRING name= {STRING_WITH_LEN("utc_timestamp") };
@@ -892,7 +897,8 @@ class Item_func_now_utc :public Item_func_now
892897
class Item_func_sysdate_local :public Item_func_now
893898
{
894899
public:
895-
Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
900+
Item_func_sysdate_local(THD *thd, decimal_digits_t dec):
901+
Item_func_now(thd, dec) {}
896902
bool const_item() const override { return 0; }
897903
LEX_CSTRING func_name_cstring() const override
898904
{
@@ -1365,7 +1371,7 @@ class Item_date_typecast :public Item_datefunc
13651371
class Item_time_typecast :public Item_timefunc
13661372
{
13671373
public:
1368-
Item_time_typecast(THD *thd, Item *a, uint dec_arg):
1374+
Item_time_typecast(THD *thd, Item *a, decimal_digits_t dec_arg):
13691375
Item_timefunc(thd, a) { decimals= dec_arg; }
13701376
LEX_CSTRING func_name_cstring() const override
13711377
{
@@ -1391,7 +1397,7 @@ class Item_time_typecast :public Item_timefunc
13911397
class Item_datetime_typecast :public Item_datetimefunc
13921398
{
13931399
public:
1394-
Item_datetime_typecast(THD *thd, Item *a, uint dec_arg):
1400+
Item_datetime_typecast(THD *thd, Item *a, decimal_digits_t dec_arg):
13951401
Item_datetimefunc(thd, a) { decimals= dec_arg; }
13961402
LEX_CSTRING func_name_cstring() const override
13971403
{
@@ -1450,8 +1456,8 @@ class Item_func_timestamp :public Item_datetimefunc
14501456
}
14511457
bool fix_length_and_dec(THD *thd) override
14521458
{
1453-
uint dec0= args[0]->datetime_precision(thd);
1454-
uint dec1= Interval_DDhhmmssff::fsp(thd, args[1]);
1459+
decimal_digits_t dec0= args[0]->datetime_precision(thd);
1460+
decimal_digits_t dec1= Interval_DDhhmmssff::fsp(thd, args[1]);
14551461
fix_attributes_datetime(MY_MAX(dec0, dec1));
14561462
set_maybe_null();
14571463
return false;
@@ -1518,8 +1524,8 @@ class Item_func_timediff :public Item_timefunc
15181524
}
15191525
bool fix_length_and_dec(THD *thd) override
15201526
{
1521-
uint dec= MY_MAX(args[0]->time_precision(thd),
1522-
args[1]->time_precision(thd));
1527+
decimal_digits_t dec= MY_MAX(args[0]->time_precision(thd),
1528+
args[1]->time_precision(thd));
15231529
fix_attributes_time(dec);
15241530
set_maybe_null();
15251531
return FALSE;
@@ -1691,7 +1697,8 @@ class Item_func_last_day :public Item_datefunc
16911697
class Func_handler_date_add_interval
16921698
{
16931699
protected:
1694-
static uint interval_dec(const Item *item, interval_type int_type)
1700+
static decimal_digits_t interval_dec(const Item *item,
1701+
interval_type int_type)
16951702
{
16961703
if (int_type == INTERVAL_MICROSECOND ||
16971704
(int_type >= INTERVAL_DAY_MICROSECOND &&
@@ -1728,8 +1735,9 @@ class Func_handler_date_add_interval_datetime:
17281735
public:
17291736
bool fix_length_and_dec(Item_handled_func *item) const override
17301737
{
1731-
uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd),
1732-
interval_dec(item->arguments()[1], int_type(item)));
1738+
decimal_digits_t dec=
1739+
MY_MAX(item->arguments()[0]->datetime_precision(current_thd),
1740+
interval_dec(item->arguments()[1], int_type(item)));
17331741
item->fix_attributes_datetime(dec);
17341742
return false;
17351743
}
@@ -1787,8 +1795,9 @@ class Func_handler_date_add_interval_time:
17871795
public:
17881796
bool fix_length_and_dec(Item_handled_func *item) const override
17891797
{
1790-
uint dec= MY_MAX(item->arguments()[0]->time_precision(current_thd),
1791-
interval_dec(item->arguments()[1], int_type(item)));
1798+
decimal_digits_t dec=
1799+
MY_MAX(item->arguments()[0]->time_precision(current_thd),
1800+
interval_dec(item->arguments()[1], int_type(item)));
17921801
item->fix_attributes_time(dec);
17931802
return false;
17941803
}
@@ -1812,8 +1821,9 @@ class Func_handler_date_add_interval_string:
18121821
public:
18131822
bool fix_length_and_dec(Item_handled_func *item) const override
18141823
{
1815-
uint dec= MY_MAX(item->arguments()[0]->datetime_precision(current_thd),
1816-
interval_dec(item->arguments()[1], int_type(item)));
1824+
decimal_digits_t dec=
1825+
MY_MAX(item->arguments()[0]->datetime_precision(current_thd),
1826+
interval_dec(item->arguments()[1], int_type(item)));
18171827
item->Type_std_attributes::set(
18181828
Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false),
18191829
DTCollation(item->default_charset(),
@@ -1854,8 +1864,8 @@ class Func_handler_add_time_datetime:
18541864
bool fix_length_and_dec(Item_handled_func *item) const override
18551865
{
18561866
THD *thd= current_thd;
1857-
uint dec0= item->arguments()[0]->datetime_precision(thd);
1858-
uint dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]);
1867+
decimal_digits_t dec0= item->arguments()[0]->datetime_precision(thd);
1868+
decimal_digits_t dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]);
18591869
item->fix_attributes_datetime(MY_MAX(dec0, dec1));
18601870
return false;
18611871
}
@@ -1888,8 +1898,8 @@ class Func_handler_add_time_time:
18881898
bool fix_length_and_dec(Item_handled_func *item) const override
18891899
{
18901900
THD *thd= current_thd;
1891-
uint dec0= item->arguments()[0]->time_precision(thd);
1892-
uint dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]);
1901+
decimal_digits_t dec0= item->arguments()[0]->time_precision(thd);
1902+
decimal_digits_t dec1= Interval_DDhhmmssff::fsp(thd, item->arguments()[1]);
18931903
item->fix_attributes_time(MY_MAX(dec0, dec1));
18941904
return false;
18951905
}
@@ -1920,9 +1930,10 @@ class Func_handler_add_time_string:
19201930
{ }
19211931
bool fix_length_and_dec(Item_handled_func *item) const override
19221932
{
1923-
uint dec0= item->arguments()[0]->decimals;
1924-
uint dec1= Interval_DDhhmmssff::fsp(current_thd, item->arguments()[1]);
1925-
uint dec= MY_MAX(dec0, dec1);
1933+
decimal_digits_t dec0= item->arguments()[0]->decimals;
1934+
decimal_digits_t dec1=
1935+
Interval_DDhhmmssff::fsp(current_thd, item->arguments()[1]);
1936+
decimal_digits_t dec= MY_MAX(dec0, dec1);
19261937
item->Type_std_attributes::set(
19271938
Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, dec, false),
19281939
DTCollation(item->default_charset(),

sql/sql_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5727,7 +5727,7 @@ class THD: public THD_count, /* this must be first */
57275727
return variables.idle_transaction_timeout;
57285728
}
57295729

5730-
return variables.net_wait_timeout;
5730+
return uint(variables.net_wait_timeout);
57315731
}
57325732

57335733
/**

sql/sql_type.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ Interval_DDhhmmssff::push_warning_wrong_or_truncated_value(THD *thd,
785785
}
786786

787787

788-
uint Interval_DDhhmmssff::fsp(THD *thd, Item *item)
788+
decimal_digits_t Interval_DDhhmmssff::fsp(THD *thd, Item *item)
789789
{
790790
switch (item->cmp_type()) {
791791
case INT_RESULT:

sql/sql_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ class Interval_DDhhmmssff: public Temporal
14951495
}
14961496
public:
14971497
// Get fractional second precision from an Item
1498-
static uint fsp(THD *thd, Item *item);
1498+
static decimal_digits_t fsp(THD *thd, Item *item);
14991499
/*
15001500
Maximum useful HOUR value:
15011501
TIMESTAMP'0001-01-01 00:00:00' + '87649415:59:59' = '9999-12-31 23:59:59'

tpool/aio_liburing.cc

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
1515

1616
#include "tpool_structs.h"
1717
#include "tpool.h"
18+
#include "my_valgrind.h"
1819
#include "mysql/service_my_print_error.h"
1920
#include "mysqld_error.h"
2021

@@ -28,11 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
2829

2930
namespace
3031
{
32+
using namespace tpool;
3133

32-
class aio_uring final : public tpool::aio
34+
class aio_uring final : public aio
3335
{
3436
public:
35-
aio_uring(tpool::thread_pool *tpool, int max_aio) : tpool_(tpool)
37+
aio_uring(thread_pool *tpool, int max_aio) : tpool_(tpool)
3638
{
3739
if (const auto e= io_uring_queue_init(max_aio, &uring_, 0))
3840
{
@@ -73,6 +75,9 @@ class aio_uring final : public tpool::aio
7375
}
7476
throw std::runtime_error("aio_uring()");
7577
}
78+
#if __has_feature(memory_sanitizer)
79+
MEM_MAKE_DEFINED(&uring_, sizeof(uring_));
80+
#endif
7681
if (io_uring_ring_dontfork(&uring_) != 0)
7782
{
7883
my_printf_error(ER_UNKNOWN_ERROR,
@@ -105,7 +110,7 @@ class aio_uring final : public tpool::aio
105110
io_uring_queue_exit(&uring_);
106111
}
107112

108-
int submit_io(tpool::aiocb *cb) final
113+
int submit_io(aiocb *cb) final
109114
{
110115
cb->m_iovec.iov_base= cb->m_buffer;
111116
cb->m_iovec.iov_len= cb->m_len;
@@ -115,7 +120,7 @@ class aio_uring final : public tpool::aio
115120
std::lock_guard<std::mutex> _(mutex_);
116121

117122
io_uring_sqe *sqe= io_uring_get_sqe(&uring_);
118-
if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD)
123+
if (cb->m_opcode == aio_opcode::AIO_PREAD)
119124
io_uring_prep_readv(sqe, cb->m_fh, &cb->m_iovec, 1, cb->m_offset);
120125
else
121126
io_uring_prep_writev(sqe, cb->m_fh, &cb->m_iovec, 1, cb->m_offset);
@@ -160,7 +165,7 @@ class aio_uring final : public tpool::aio
160165
abort();
161166
}
162167

163-
auto *iocb= static_cast<tpool::aiocb*>(io_uring_cqe_get_data(cqe));
168+
auto *iocb= static_cast<aiocb*>(io_uring_cqe_get_data(cqe));
164169
if (!iocb)
165170
break; // ~aio_uring() told us to terminate
166171

@@ -174,6 +179,10 @@ class aio_uring final : public tpool::aio
174179
{
175180
iocb->m_err= 0;
176181
iocb->m_ret_len= res;
182+
#if __has_feature(memory_sanitizer)
183+
if (iocb->m_opcode == aio_opcode::AIO_PREAD)
184+
MEM_MAKE_DEFINED(iocb->m_buffer, res);
185+
#endif
177186
}
178187

179188
io_uring_cqe_seen(&aio->uring_, cqe);
@@ -193,7 +202,7 @@ class aio_uring final : public tpool::aio
193202

194203
io_uring uring_;
195204
std::mutex mutex_;
196-
tpool::thread_pool *tpool_;
205+
thread_pool *tpool_;
197206
std::thread thread_;
198207

199208
std::vector<native_file_handle> files_;

0 commit comments

Comments
 (0)