mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
b5df1d3446
- If not in autocommit mode, delete rows one by one so that we can roll back if necessary - bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten - Fixed bug in bitmap handling when allocation tail pages - Ensure we reserve place for directory entry when calculation place for head and tail pages - Fixed wrong value in bitmap->size[0] - Fixed wrong assert in flush_log_for_bitmap - Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset - Mark new pages as changed (Required to get repair() to work) - Fixed problem with advancing log horizon pointer within one page bounds - Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert() - Fixed bug in logging of rows with more than one big blob - Fixed DBUG_ASSERTS() in pagecache to allow change of WRITE_LOCK to READ_LOCK in unlock() calls - Flush pagecache when we change from logging to not logging (if not, pagecache code breaks) - Ensure my_errno is set on return from write/delete/update - Fixed bug when using FIELD_SKIP_PRESPACE New features: - mysql_fix_privilege_tables now first uses binaries and scripts from source distribution, then in installed distribution - Fix that optimize works for Maria tables - maria_check --zerofill now also clear freed blob pages - maria_check -di now prints more information about record page utilization Optimizations: - Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block) - Simplify code to abort when we found optimal bit pattern - Skip also full head page bit patterns when searching for tail - Increase default repair buffer to 128M for maria_chk and maria_read_log - Increase default sort buffer for maria_chk to 64M - Increase size of sortbuffer and pagecache for mysqld to 64M - VARCHAR/CHAR fields are stored in increasing length order for BLOCK_RECORD tables Better reporting: - Fixed test of error condition for flush (for better error code) - More error messages to mysqld if Maria recovery fails - Always print warning if rows are deleted in repair - Added global function _db_force_flush() that is usable when doing debugging in gdb - Added call to my_debug_put_break_here() in case of some errors (for debugging) - Remove used testfiles in unittest as these was written in different directories depending on from where the test was started This should fix the bugs found when importing a big table with many varchars and one/many blobs to Maria dbug/dbug.c: Added global function _db_force_flush() that is usable when doing debugging in gdbine extra/replace.c: Fixed memory leak include/my_dbug.h: Prototype for _db_force_flush() include/my_global.h: Added stdarg.h as my_sys.h now depends on it. include/my_sys.h: Make my_dbug_put_break_here() a NOP if not DBUG build Added my_printv_error() include/myisamchk.h: Added entry 'lost' to be able to count space that is lost forever mysql-test/r/maria.result: Updated results mysql-test/t/maria.test: Reset autocommit after test New test to check if delete_all_rows is used (verified with --debug) mysys/my_error.c: Added my_printv_error() scripts/mysql_fix_privilege_tables.sh: First use binaries and scripts from source distribution, then in installed distribution This ensures that a development branch doesn't pick up wrong scripts) sql/mysqld.cc: Fix that one can break maria recovery with ^C when debugging sql/sql_class.cc: Removed #ifdef that has no effect (The preceeding DBUG_ASSERT() ensures that the following code will not be exectued) storage/maria/ha_maria.cc: Increase size of sortbuffer and pagecache to 64M Fix that optimize works for Maria tables Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert() If not in autocommit mode, delete rows one by one so that we can roll back if necessary Fixed variable comments storage/maria/ma_bitmap.c: More ASSERTS to detect overwrite of bitmap pages bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten Ensure we reserve place for directory entry when calculation place for head and tail pages bitmap->size[0] should not include space for directory entry Simplify code to abort when we found optimal bit pattern Skip also full head page bit patterns when searching for tail (should speed up some common cases) Fixed bug in allocate_tail() when block->used was not aligned on 6 bytes Fixed wrong assert in flush_log_for_bitmap Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset storage/maria/ma_blockrec.c: Ensure my_errno is set on return Fixed not optimal setting of row->min_length if we don't have variable length fields Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block) Added DBUG_ASSERT() if we read or write wrong VARCHAR data Added DBUG_ASSERT() to find out if row sizes are calculated wrong Fixed bug in logging of rows with more than one big blob storage/maria/ma_check.c: Disable logging while normal repair is done to avoid logging of index changes Fixed bug that caused CHECKSUM part of key page to be used Fixed that deleted of wrong records also works for BLOCK_RECORD Clear unallocated pages: - BLOB pages are not automaticly cleared on delete, so we need to use the bitmap to know if page is used or not Better error reporting More information about record page utilization Change printing of file position to printing of pages to make output more readable Always print warning if rows are deleted storage/maria/ma_create.c: Calculate share.base_max_pack_length more accurately for BLOCK_RECORD pages (for future) Fixed that FIELD_SKIP_PRESPACE is recorded as FIELD_NORMAL; Fixed bug where fields could be used in wrong order Store FIELD_SKIP_ZERO fields before CHAR and VARCHAR fields (optimization) Store other fields in length order (to get better utilization of head block) storage/maria/ma_delete.c: Ensure my_errno is set on return storage/maria/ma_dynrec.c: Indentation fix storage/maria/ma_locking.c: Set changed if open_count is counted down. (To avoid getting error "client is using or hasn't closed the table properly" with transactional tables storage/maria/ma_loghandler.c: Fixed problem with advancing log horizon pointer within one page bounds (Patch from Sanja) Added more DBUG Indentation fixes storage/maria/ma_open.c: Removed wrong casts storage/maria/ma_page.c: Fixed usage of PAGECACHE_LOCK_WRITE_UNLOCK with _ma_new() Mark new pages as changed (Required to get repair() to work) storage/maria/ma_pagecache.c: Fixed test of error condition for flush Fixed problem when using PAGECACHE_LOCK_WRITE_TO_READ with unlock() Added call to my_debug_put_break_here() in case of errors (for debugging) storage/maria/ma_pagecrc.c: Ensure we get same crc for 32 and 64 bit systems by forcing argument to maria_page_crc to uint32 storage/maria/ma_recovery.c: Call my_printv_error() from eprint() to get critical errors to mysqld log Removed \n from error strings to eprint() to get nicer output in mysqld Added simple test in _ma_reenable_logging_for_table() to not do any work if not needed storage/maria/ma_update.c: Ensure my_errno is set on return storage/maria/ma_write.c: Ensure my_errno is set on return storage/maria/maria_chk.c: Use DEBUGGER_OFF if --debug is not use (to get slightly faster execution for debug binaries) Added option --skip-safemalloc Don't write exponents for rec/key storage/maria/maria_def.h: Increase default repair buffer to 128M for maria_chk and maria_read_log Increase default sort buffer for maria_chk to 64M storage/maria/unittest/Makefile.am: Don't update files automaticly from bitkeeper storage/maria/unittest/ma_pagecache_consist.c: Remove testfile at end storage/maria/unittest/ma_pagecache_single.c: Remove testfile at end storage/maria/unittest/ma_test_all-t: More tests Safer checking if test caused error
223 lines
5.7 KiB
Bash
223 lines
5.7 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) 2000-2006 MySQL AB
|
|
#
|
|
# 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
|
|
# the Free Software Foundation; version 2 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
# This script is a wrapper to pipe the mysql_fix_privilege_tables.sql
|
|
# through the mysql client program to the mysqld server
|
|
|
|
# Default values (Can be changed in my.cnf)
|
|
password=""
|
|
host="localhost"
|
|
user="root"
|
|
sql_only=0
|
|
basedir="@prefix@"
|
|
verbose=0
|
|
args=""
|
|
# no elaborate fallback here; with no argument, it will happen in "mysql"
|
|
port=""
|
|
socket=""
|
|
database="mysql"
|
|
bindir=""
|
|
pkgdatadir="@pkgdatadir@"
|
|
print_defaults_bindir="."
|
|
|
|
file=mysql_fix_privilege_tables.sql
|
|
|
|
# The following test is to make this script compatible with the 4.0 where
|
|
# the single argument could be a password
|
|
if test "$#" = 1
|
|
then
|
|
case "$1" in
|
|
--*) ;;
|
|
*) old_style_password="$1" ; shift ;;
|
|
esac
|
|
fi
|
|
|
|
# The following code is almost identical to the code in mysql_install_db.sh
|
|
|
|
case "$1" in
|
|
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
|
|
defaults="$1"; shift
|
|
;;
|
|
esac
|
|
|
|
parse_arguments() {
|
|
# We only need to pass arguments through to the server if we don't
|
|
# handle them here. So, we collect unrecognized options (passed on
|
|
# the command line) into the args variable.
|
|
pick_args=
|
|
if test "$1" = PICK-ARGS-FROM-ARGV
|
|
then
|
|
pick_args=1
|
|
shift
|
|
fi
|
|
|
|
for arg do
|
|
case "$arg" in
|
|
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
--password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
--host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
--sql|--sql-only) sql_only=1 ;;
|
|
--verbose) verbose=1 ;;
|
|
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
|
|
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
|
|
--database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
|
|
--bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"`
|
|
print_defaults_bindir=$bindir
|
|
;;
|
|
*)
|
|
if test -n "$pick_args"
|
|
then
|
|
# This sed command makes sure that any special chars are quoted,
|
|
# so the arg gets passed exactly to the server.
|
|
args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
# Get first arguments from the my.cfg file, groups [mysqld] and
|
|
# [mysql_install_db], and then merge with the command line arguments
|
|
|
|
print_defaults=my_print_defaults
|
|
for dir in ./extra ./bin @bindir@ @bindir@ $print_defaults_bindir/../bin $print_defaults_bindir/../extra
|
|
do
|
|
if test -x $dir/my_print_defaults
|
|
then
|
|
print_defaults="$dir/my_print_defaults"
|
|
break
|
|
fi
|
|
done
|
|
|
|
parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables`
|
|
parse_arguments PICK-ARGS-FROM-ARGV "$@"
|
|
|
|
if test -z "$password"
|
|
then
|
|
password=$old_style_password
|
|
fi
|
|
|
|
# Find where 'mysql' command is located
|
|
|
|
dirname=`dirname "$0"`
|
|
|
|
if test -z "$bindir"
|
|
then
|
|
for i in "$dirname/../client" $basedir/bin @bindir@
|
|
do
|
|
if test -f $i/mysql
|
|
then
|
|
bindir=$i
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if test -z "$bindir"
|
|
then
|
|
echo "Could not find MySQL command-line client (mysql)."
|
|
echo "Please use --basedir to specify the directory where MySQL is installed."
|
|
exit 1
|
|
fi
|
|
|
|
cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
|
|
if test ! -z "$port"; then
|
|
cmd="$cmd --port=$port"
|
|
fi
|
|
if test ! -z "$socket"; then
|
|
cmd="$cmd --socket=$socket"
|
|
fi
|
|
cmd="$cmd --database=$database"
|
|
|
|
if test $sql_only = 1
|
|
then
|
|
cmd="cat"
|
|
fi
|
|
|
|
# Find where first mysql_fix_privilege_tables.sql is located
|
|
for i in "$dirname" $basedir/support-files $basedir/share \
|
|
$basedir/share/mysql $basedir/scripts $pkgdatadir .
|
|
do
|
|
if test -f $i/$file
|
|
then
|
|
pkgdatadir=$i
|
|
break
|
|
fi
|
|
done
|
|
|
|
sql_file="$pkgdatadir/$file"
|
|
if test ! -f $sql_file
|
|
then
|
|
echo "Could not find file '$file'."
|
|
echo "Please use --basedir to specify the directory where MySQL is installed"
|
|
exit 1
|
|
fi
|
|
|
|
s_echo()
|
|
{
|
|
if test $sql_only = 0
|
|
then
|
|
echo $1
|
|
fi
|
|
}
|
|
|
|
s_echo "This script updates all the mysql privilege tables to be usable by"
|
|
s_echo "the current version of MySQL"
|
|
s_echo ""
|
|
|
|
if test $verbose = 1
|
|
then
|
|
s_echo "You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
|
|
s_echo "because these just mean that your tables are already up to date."
|
|
s_echo "This script is safe to run even if your tables are already up to date!"
|
|
s_echo ""
|
|
fi
|
|
|
|
run_cmd() {
|
|
# Password argument is added here to allow for spaces in password.
|
|
|
|
if test ! -z "$password"
|
|
then
|
|
cat $sql_file | $cmd --password="$password"
|
|
else
|
|
cat $sql_file | $cmd
|
|
fi
|
|
}
|
|
|
|
if test $verbose = 0
|
|
then
|
|
run_cmd > /dev/null 2>&1
|
|
else
|
|
run_cmd > /dev/null
|
|
fi
|
|
if test $? = 0
|
|
then
|
|
s_echo "done"
|
|
else
|
|
s_echo "Got a failure from command:"
|
|
s_echo "cat $sql_file | $cmd"
|
|
s_echo "Please check the above output and try again."
|
|
if test $verbose = 0
|
|
then
|
|
s_echo ""
|
|
s_echo "Running the script with the --verbose option may give you some information"
|
|
s_echo "of what went wrong."
|
|
fi
|
|
s_echo ""
|
|
s_echo "If you get an 'Access denied' error, you should run this script again and"
|
|
s_echo "give the MySQL root user password as an argument with the --password= option"
|
|
fi
|