Skip to content

Commit

Permalink
Merge branch '10.4' into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Nov 8, 2023
2 parents a44869d + c4143f9 commit 6cfd2ba
Show file tree
Hide file tree
Showing 396 changed files with 10,334 additions and 5,807 deletions.
21 changes: 3 additions & 18 deletions client/mysqladmin.cc
Expand Up @@ -435,6 +435,7 @@ int main(int argc,char *argv[])
if (error > 0)
break;

error= -error; /* don't exit with negative error codes */
/*
Command was well-formed, but failed on the server. Might succeed
on retry (if conditions on server change etc.), but needs --force
Expand Down Expand Up @@ -1208,24 +1209,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else
if (mysql_query(mysql,buff))
{
if (mysql_errno(mysql)!=1290)
{
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
}
else
{
/*
We don't try to execute 'update mysql.user set..'
because we can't perfectly find out the host
*/
my_printf_error(0,"\n"
"You cannot use 'password' command as mysqld runs\n"
" with grant tables disabled (was started with"
" --skip-grant-tables).\n"
"Use: \"mysqladmin flush-privileges password '*'\""
" instead", error_flags);
}
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
ret = -1;
}
password_done:
Expand Down
9 changes: 7 additions & 2 deletions client/mysqlbinlog.cc
Expand Up @@ -3169,8 +3169,13 @@ int main(int argc, char** argv)

if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file && result_file != stdout)
my_fclose(result_file, MYF(0));
if (result_file)
{
if (result_file != stdout)
my_fclose(result_file, MYF(0));
else
fflush(result_file);
}
cleanup();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(my_end_arg | MY_DONT_FREE_DBUG);
Expand Down
9 changes: 7 additions & 2 deletions client/mysqldump.c
Expand Up @@ -1836,8 +1836,13 @@ static FILE* open_sql_file_for_table(const char* table, int flags)

static void free_resources()
{
if (md_result_file && md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
if (md_result_file)
{
if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
else
fflush(md_result_file);
}
if (get_table_name_result)
mysql_free_result(get_table_name_result);
if (routine_res)
Expand Down
19 changes: 16 additions & 3 deletions extra/mariabackup/ds_local.cc
Expand Up @@ -28,6 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <winioctl.h>
#endif

#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
#include <linux/falloc.h>
#endif

typedef struct {
File fd;
my_bool init_ibd_done;
Expand Down Expand Up @@ -160,9 +164,18 @@ static int write_compressed(File fd, uchar *data, size_t len, size_t pagesize)
if (datasize < n_bytes) {
/* This punches a "hole" in the file. */
size_t hole_bytes = n_bytes - datasize;
if (my_seek(fd, hole_bytes, MY_SEEK_CUR, MYF(MY_WME | MY_NABP))
== MY_FILEPOS_ERROR)
return 1;
my_off_t off = my_seek(fd, hole_bytes, MY_SEEK_CUR, MYF(MY_WME | MY_NABP));
if (off == MY_FILEPOS_ERROR)
return 1;
#ifdef HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
/* punch holes harder for filesystems (like XFS) that
heuristically decide whether leave a hole after the
above or not based on the current access pattern
(which is sequential write and not at all typical for
what InnoDB will be doing with the file later */
fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
off - hole_bytes, hole_bytes);
#endif
}
written += n_bytes;
ptr += n_bytes;
Expand Down
131 changes: 129 additions & 2 deletions include/my_compare.h
Expand Up @@ -110,8 +110,135 @@ static inline void set_rec_bits(uint16 bits, uchar *ptr, uchar ofs, uint len)
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)

extern int ha_compare_text(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t , my_bool);

/*
Compare two VARCHAR values.
@param charset_info - The character set and collation
@param a - The pointer to the first string
@param a_length - The length of the first string
@param b - The pointer to the second string
@param b_length - The length of the second string
@param b_is_prefix - Whether "b" is a prefix of "a",
e.g. in a prefix key (partial length key).
@returns - The result of comparison
- If "b_is_prefix" is FALSE, then the two strings are compared
taking into account the PAD SPACE/NO PAD attribute of the collation.
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
This is done e.g. when we compare a column value to its prefix key value
(the value of "a" to the value of "key_a"):
CREATE TABLE t1 (a VARCHAR(10), KEY(key_a(5));
*/
static inline int ha_compare_char_varying(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return charset_info->coll->strnncollsp(charset_info, a, a_length,
b, b_length);
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length, TRUE/*prefix*/);
}


/*
Compare two CHAR values of the same declared character length,
e.g. CHAR(5) to CHAR(5).
@param charset_info - The character set and collation
@param a - The pointer to the first string
@param a_length - The length of the first string
@param b - The pointer to the second string
@param b_length - The length of the second string
@param nchars - The declared length (in characters)
@param b_is_prefix - Whether "b" is a prefix of "a",
e.g. in a prefix key (partial length key).
@returns - The result of comparison
- If "b_is_prefix" is FALSE, then the two strings are compared
taking into account the PAD SPACE/NO PAD attribute of the collation.
Additionally, this function assumes that the underlying storage could
optionally apply trailing space compression, so values can come into this
comparison function in different states:
- all trailing spaces removed
- some trailing spaced removed
- no trailing spaces removed (exactly "nchars" characters on the two sides)
This function virtually reconstructs trailing spaces up to the defined
length specified in "nchars".
If either of the sides have more than "nchar" characters,
then only leftmost "nchar" characters are compared.
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
This is done e.g. when we compare a column value to its prefix key value
(the value of "a" to the value of "key_a"):
CREATE TABLE t1 (a CHAR(10), KEY(key_a(5));
*/
static inline int ha_compare_char_fixed(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
size_t nchars,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return charset_info->coll->strnncollsp_nchars(charset_info,
a, a_length,
b, b_length,
nchars,
MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES);
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length, TRUE/*prefix*/);
}


/*
A function to compare words of a text.
This is a common operation in full-text search:
SELECT MATCH (title) AGAINST ('word') FROM t1;
*/
static inline int ha_compare_word(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length)
{
return charset_info->coll->strnncollsp(charset_info,
a, a_length,
b, b_length);
}


/*
A function to compare a word of a text to a word prefix.
This is a common operation in full-text search:
SELECT MATCH (title) AGAINST ('wor*' IN BOOLEAN MODE) FROM t1;
*/
static inline int ha_compare_word_prefix(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length)
{
return charset_info->coll->strnncoll(charset_info,
a, a_length,
b, b_length,
TRUE/*b_is_prefix*/);
}


/*
Compare words (full match or prefix match), e.g. for full-text search.
*/
static inline int ha_compare_word_or_prefix(CHARSET_INFO *charset_info,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
my_bool b_is_prefix)
{
if (!b_is_prefix)
return ha_compare_word(charset_info, a, a_length, b, b_length);
return ha_compare_word_prefix(charset_info, a, a_length, b, b_length);
}


extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
const uchar *b, uint key_length, uint nextflag,
uint *diff_pos);
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
92 changes: 85 additions & 7 deletions man/innochecksum.1
Expand Up @@ -34,7 +34,7 @@ CHECK TABLE
to check tables within the tablespace\&.
.PP
If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use
\fBmysqldump\fR
\fBmariadb-dump\fR
to make a backup of the tables within the tablespace\&.
.PP
Invoke
Expand Down Expand Up @@ -75,9 +75,9 @@ Displays help and exits\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-c, --count\fR
\fB\-a \fR\fB\fInum\fB, --allow-mismatches=#\fR
.sp
Print a count of the number of pages in the file\&.
Maximum checksum mismatch allowed before innochecksum terminates. Defaults to 0, which terminates on the first mismatch\&.
.RE
.sp
.RS 4
Expand All @@ -88,9 +88,9 @@ Print a count of the number of pages in the file\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-d, --debug\fR
\fB\-c, --count\fR
.sp
Debug mode; prints checksums for each page\&.
Print a count of the number of pages in the file\&.
.RE
.sp
.RS 4
Expand Down Expand Up @@ -140,7 +140,7 @@ Synonym for \fB--help\fR\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-l, --leaf\fR
\fB\-f, --leaf\fR
.sp
Examine leaf index pages\&.
.RE
Expand All @@ -153,6 +153,19 @@ Examine leaf index pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-l \fR\fB\fIfn\fB, --log=fn\fR\fR
.sp
Log output to the specified filename, fn\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-m \fR\fB\fInum\fB, --merge=#\fR\fR
.sp
Leaf page count if merge given number of consecutive pages\&.
Expand All @@ -166,6 +179,19 @@ Leaf page count if merge given number of consecutive pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-n, --no-check\fR\fR
.sp
Ignore the checksum verification. Until MariaDB 10.6, must be used with the --write option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-p \fR\fB\fInum\fB, --page-num=#\fR\fR
.sp
Check only this page number\&.
Expand All @@ -179,6 +205,32 @@ Check only this page number\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-D \fR\fB\fIname\fB, --page-type-dump=name\fR\fR
.sp
Dump the page type info for each page in a tablespace\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-S, --page-type-summary\fR\fR
.sp
Display a count of each page type in a tablespace\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-s \fR\fB\fInum\fB, --start-page\fR\fR
.sp
Start at this page number\&.
Expand All @@ -205,6 +257,32 @@ Skip corrupt pages\&.
.sp -1
.IP \(bu 2.3
.\}
\fB\-C \fR\fB\fIname\fB, --strict-check=name\fR\fR
.sp
Specify the strict checksum algorithm. One of: crc32, innodb, none. If not specified, validates against innodb, crc32 and none. Removed in MariaDB 10.6\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-w \fR\fB\fIname\fB, --write=name\fR\fR
.sp
Rewrite the checksum algorithm. One of crc32, innodb, none. An exclusive lock is obtained during use. Use in conjunction with the -no-check option to rewrite an invalid checksum. Removed in MariaDB 10.6\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-v, --verbose\fR
.sp
Verbose mode; print a progress indicator every five seconds\&.
Expand All @@ -225,7 +303,7 @@ Displays version information and exits\&.
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2019 MariaDB Foundation
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2023 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
Expand Down

0 comments on commit 6cfd2ba

Please sign in to comment.