@@ -6727,8 +6727,8 @@ wsrep_innobase_mysql_sort(
6727
6727
case MYSQL_TYPE_LONG_BLOB:
6728
6728
case MYSQL_TYPE_VARCHAR:
6729
6729
{
6730
- uchar * tmp_str;
6731
- uint tmp_length;
6730
+ uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'} ;
6731
+ uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN ;
6732
6732
6733
6733
/* Use the charset number to pick the right charset struct for
6734
6734
the comparison. Since the MySQL function get_charset may be
@@ -6751,12 +6751,7 @@ wsrep_innobase_mysql_sort(
6751
6751
}
6752
6752
}
6753
6753
6754
- // Note that strnxfrm may change length of string
6755
- tmp_length= charset->coll->strnxfrmlen(charset, str_length);
6756
- tmp_length= tmp_length * charset->mbmaxlen;
6757
- tmp_length= ut_max(str_length, tmp_length) + charset->mbmaxlen;
6758
- tmp_str= static_cast<uchar *>(ut_malloc_nokey(tmp_length));
6759
- ut_ad(str_length <= tmp_length);
6754
+ ut_a(str_length <= tmp_length);
6760
6755
memcpy(tmp_str, str, str_length);
6761
6756
6762
6757
tmp_length = charset->coll->strnxfrm(charset, str, str_length,
@@ -6780,7 +6775,6 @@ wsrep_innobase_mysql_sort(
6780
6775
ret_length = tmp_length;
6781
6776
}
6782
6777
6783
- ut_free(tmp_str);
6784
6778
break;
6785
6779
}
6786
6780
case MYSQL_TYPE_DECIMAL :
@@ -7132,7 +7126,7 @@ wsrep_store_key_val_for_row(
7132
7126
THD* thd,
7133
7127
TABLE* table,
7134
7128
uint keynr, /*!< in: key number */
7135
- uchar * buff, /*!< in/out: buffer for the key value (in MySQL
7129
+ char * buff, /*!< in/out: buffer for the key value (in MySQL
7136
7130
format) */
7137
7131
uint buff_len,/*!< in: buffer length */
7138
7132
const uchar* record,
@@ -7141,7 +7135,7 @@ wsrep_store_key_val_for_row(
7141
7135
KEY* key_info = table->key_info + keynr;
7142
7136
KEY_PART_INFO* key_part = key_info->key_part;
7143
7137
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
7144
- uchar * buff_start = buff;
7138
+ char * buff_start = buff;
7145
7139
enum_field_types mysql_type;
7146
7140
Field* field;
7147
7141
uint buff_space = buff_len;
@@ -7153,8 +7147,7 @@ wsrep_store_key_val_for_row(
7153
7147
7154
7148
for (; key_part != end; key_part++) {
7155
7149
7156
- uchar *sorted=NULL;
7157
- uint max_len=0;
7150
+ uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
7158
7151
ibool part_is_null = FALSE;
7159
7152
7160
7153
if (key_part->null_bit) {
@@ -7233,14 +7226,10 @@ wsrep_store_key_val_for_row(
7233
7226
true_len = key_len;
7234
7227
}
7235
7228
7236
- max_len= true_len;
7237
- sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
7238
7229
memcpy(sorted, data, true_len);
7239
7230
true_len = wsrep_innobase_mysql_sort(
7240
7231
mysql_type, cs->number, sorted, true_len,
7241
- max_len);
7242
- ut_ad(true_len <= max_len);
7243
-
7232
+ REC_VERSION_56_MAX_INDEX_COL_LEN);
7244
7233
if (wsrep_protocol_version > 1) {
7245
7234
/* Note that we always reserve the maximum possible
7246
7235
length of the true VARCHAR in the key value, though
@@ -7325,13 +7314,11 @@ wsrep_store_key_val_for_row(
7325
7314
true_len = key_len;
7326
7315
}
7327
7316
7328
- max_len= true_len;
7329
- sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
7330
7317
memcpy(sorted, blob_data, true_len);
7331
7318
true_len = wsrep_innobase_mysql_sort(
7332
7319
mysql_type, cs->number, sorted, true_len,
7333
- max_len );
7334
- ut_ad(true_len <= max_len);
7320
+ REC_VERSION_56_MAX_INDEX_COL_LEN );
7321
+
7335
7322
7336
7323
/* Note that we always reserve the maximum possible
7337
7324
length of the BLOB prefix in the key value. */
@@ -7407,14 +7394,10 @@ wsrep_store_key_val_for_row(
7407
7394
cs->mbmaxlen),
7408
7395
&error);
7409
7396
}
7410
-
7411
- max_len= true_len;
7412
- sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
7413
7397
memcpy(sorted, src_start, true_len);
7414
7398
true_len = wsrep_innobase_mysql_sort(
7415
7399
mysql_type, cs->number, sorted, true_len,
7416
- max_len);
7417
- ut_ad(true_len <= max_len);
7400
+ REC_VERSION_56_MAX_INDEX_COL_LEN);
7418
7401
7419
7402
if (true_len > buff_space) {
7420
7403
fprintf (stderr,
@@ -7429,11 +7412,6 @@ wsrep_store_key_val_for_row(
7429
7412
buff += true_len;
7430
7413
buff_space -= true_len;
7431
7414
}
7432
-
7433
- if (sorted) {
7434
- ut_free(sorted);
7435
- sorted= NULL;
7436
- }
7437
7415
}
7438
7416
7439
7417
ut_a(buff <= buff_start + buff_len);
@@ -10510,7 +10488,7 @@ wsrep_append_key(
10510
10488
trx_t *trx,
10511
10489
TABLE_SHARE *table_share,
10512
10490
TABLE *table,
10513
- const uchar * key,
10491
+ const char * key,
10514
10492
uint16_t key_len,
10515
10493
wsrep_key_type key_type /*!< in: access type of this key
10516
10494
(shared, exclusive, semi...) */
@@ -10614,8 +10592,8 @@ ha_innobase::wsrep_append_keys(
10614
10592
10615
10593
if (wsrep_protocol_version == 0) {
10616
10594
uint len;
10617
- uchar keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10618
- uchar *key = &keyval[0];
10595
+ char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10596
+ char *key = &keyval[0];
10619
10597
ibool is_null;
10620
10598
10621
10599
len = wsrep_store_key_val_for_row(
@@ -10647,18 +10625,18 @@ ha_innobase::wsrep_append_keys(
10647
10625
10648
10626
for (i=0; i<table->s->keys; ++i) {
10649
10627
uint len;
10650
- uchar keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10651
- uchar keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10652
- uchar * key0 = &keyval0[1];
10653
- uchar * key1 = &keyval1[1];
10628
+ char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10629
+ char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
10630
+ char * key0 = &keyval0[1];
10631
+ char * key1 = &keyval1[1];
10654
10632
KEY* key_info = table->key_info + i;
10655
10633
ibool is_null;
10656
10634
10657
10635
dict_index_t* idx = innobase_get_index(i);
10658
10636
dict_table_t* tab = (idx) ? idx->table : NULL;
10659
10637
10660
- keyval0[0] = (uchar )i;
10661
- keyval1[0] = (uchar )i;
10638
+ keyval0[0] = (char )i;
10639
+ keyval1[0] = (char )i;
10662
10640
10663
10641
if (!tab) {
10664
10642
WSREP_WARN("MariaDB-InnoDB key mismatch %s %s",
@@ -10716,7 +10694,7 @@ ha_innobase::wsrep_append_keys(
10716
10694
10717
10695
wsrep_calc_row_hash(digest, record0, table, m_prebuilt, thd);
10718
10696
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
10719
- (const uchar *) digest, 16,
10697
+ (const char *) digest, 16,
10720
10698
key_type))) {
10721
10699
DBUG_RETURN(rcode);
10722
10700
}
@@ -10726,7 +10704,7 @@ ha_innobase::wsrep_append_keys(
10726
10704
digest, record1, table, m_prebuilt, thd);
10727
10705
if ((rcode = wsrep_append_key(thd, trx, table_share,
10728
10706
table,
10729
- (const uchar *) digest,
10707
+ (const char *) digest,
10730
10708
16, key_type))) {
10731
10709
DBUG_RETURN(rcode);
10732
10710
}
0 commit comments