mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '11.8' into 12.0
This commit is contained in:
@@ -286,7 +286,7 @@ IF(WIN32)
|
||||
# The resulting files will have .pl extension (those are perl scripts)
|
||||
|
||||
# Input files with pl.in extension
|
||||
SET(PLIN_FILES mysql_config)
|
||||
SET(PLIN_FILES mysql_config print_ddl_recovery_log)
|
||||
# Input files with .sh extension
|
||||
|
||||
SET(SH_FILES mysql_convert_table_format mysqld_multi mysqldumpslow
|
||||
@@ -345,6 +345,8 @@ ELSE()
|
||||
# Configure this one, for testing, but do not install it.
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_config.pl.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysql_config.pl ESCAPE_QUOTES @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/print_ddl_recovery_log.pl.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/print_ddl_recovery_log.pl ESCAPE_QUOTES @ONLY)
|
||||
# On Unix, most of the files end up in the bin directory
|
||||
SET(BIN_SCRIPTS
|
||||
msql2mysql
|
||||
@@ -406,7 +408,7 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
# Install libgcc as mylibgcc.a
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
|
||||
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_FLAGS MATCHES "-static")
|
||||
EXECUTE_PROCESS (
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}
|
||||
${CMAKE_CXX_FLAGS} --print-libgcc
|
||||
|
120
scripts/print_ddl_recovery_log.pl.in
Executable file
120
scripts/print_ddl_recovery_log.pl.in
Executable file
@@ -0,0 +1,120 @@
|
||||
#!@PERL_PATH@
|
||||
use warnings;
|
||||
use Fcntl qw(:seek);
|
||||
use Getopt::Long;
|
||||
|
||||
# Constants based on the source
|
||||
use constant {
|
||||
BLOCK_SIZE => 4096,
|
||||
DDL_LOG_ACTION_TYPE_POS => 1,
|
||||
DDL_LOG_PHASE_POS => 2,
|
||||
DDL_LOG_NEXT_ENTRY_POS => 4,
|
||||
DDL_LOG_FLAG_POS => 8,
|
||||
DDL_LOG_XID_POS => 10,
|
||||
DDL_LOG_UUID_POS => 18,
|
||||
MY_UUID_SIZE => 16,
|
||||
DDL_LOG_ID_POS => 34,
|
||||
DDL_LOG_END_POS => 42,
|
||||
NAME_START_POS => 56,
|
||||
};
|
||||
|
||||
package main;
|
||||
|
||||
my @log_entrys= ("Unknown", "EXECUTE", "ENTRY", "IGNORED" );
|
||||
my @log_actions= ("Unknown", "DELETE_FRM", "RENAME_FRM", "REPLACE", "EXCHANGE",
|
||||
"RENAME_TABLE", "RENAME_VIEW", "DROP_INIT", "DROP_TABLE",
|
||||
"DROP_VIEW", "DROP_TRIGGER", "DROP_DB", "CREATE_TABLE",
|
||||
"CREATE_VIEW", "DELETE_TMP_FILE", "CREATE_TRIGGER",
|
||||
"ALTER_TABLE", "STORE_QUERY");
|
||||
|
||||
$opt_skip_not_used= undef;
|
||||
$opt_skip_ignored= undef;
|
||||
|
||||
sub usage
|
||||
{
|
||||
print <<EOF;
|
||||
Usage $0 [OPTIONS] path-to-MariaDB-ddl_recovery.log
|
||||
|
||||
Print the content of the MariaDB ddl_recovery.log.
|
||||
One can also just provide the directory for the ddl_recover.log.
|
||||
|
||||
Options:
|
||||
--skip-not-used\tSkip not used ddl log entries
|
||||
--skip-ignored\tSkip ignored ddl log entries
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
GetOptions("skip-not-used", "skip-ignored") or usage();
|
||||
|
||||
my $file = shift;
|
||||
my $fh;
|
||||
|
||||
if (!defined($file))
|
||||
{
|
||||
usage();
|
||||
}
|
||||
|
||||
if (-d $file)
|
||||
{
|
||||
$file= $file . "/ddl_recovery.log";
|
||||
}
|
||||
|
||||
open $fh, '<:raw', $file or die "Cannot open $file: $!";
|
||||
|
||||
# Skip header block
|
||||
exit 0 if (!read($fh, my $block, BLOCK_SIZE));
|
||||
|
||||
my $entry_num = 1;
|
||||
|
||||
while (read($fh, my $block, BLOCK_SIZE)) {
|
||||
|
||||
my $entry_type = unpack("C", substr($block, 0, 1));
|
||||
my $action_type = unpack("C", substr($block, DDL_LOG_ACTION_TYPE_POS, 1));
|
||||
my $phase = unpack("C", substr($block, DDL_LOG_PHASE_POS, 1));
|
||||
my $next_entry = unpack("V", substr($block, DDL_LOG_NEXT_ENTRY_POS, 4));
|
||||
my $flags = unpack("v", substr($block, DDL_LOG_FLAG_POS, 2));
|
||||
my $xid = unpack("Q<", substr($block, DDL_LOG_XID_POS, 8));
|
||||
my $uuid_bin = substr($block, DDL_LOG_UUID_POS, MY_UUID_SIZE);
|
||||
my $unique_id = unpack("Q<", substr($block, DDL_LOG_ID_POS, 8));
|
||||
|
||||
my $uuid = unpack("H8H4H4H4H12", $uuid_bin);
|
||||
$uuid = join('-', $uuid =~ /(.{8})(.{4})(.{4})(.{4})(.{12})/);
|
||||
|
||||
my $pos = NAME_START_POS;
|
||||
my @strings;
|
||||
for (1..7) {
|
||||
my ($str, $len);
|
||||
$len = unpack("v", substr($block, $pos, 2));
|
||||
$pos += 2;
|
||||
last if ($pos + $len > BLOCK_SIZE);
|
||||
$str = substr($block, $pos, $len);
|
||||
$pos += $len+1;
|
||||
push @strings, $str;
|
||||
}
|
||||
|
||||
print "\n" if ($entry_num > 1);
|
||||
print "=== DDL Log Entry $entry_num ===\n";
|
||||
$entry_num++;
|
||||
|
||||
print "Entry Type : $log_entrys[$entry_type]\n";
|
||||
next if ($opt_skip_not_used && $entry_type == 0);
|
||||
next if ($opt_skip_ignored && $entry_type >= 3);
|
||||
|
||||
print "Action Type : $log_actions[$action_type]\n";
|
||||
print "Phase : $phase\n";
|
||||
print "Next Entry : $next_entry\n";
|
||||
print "Flags : $flags\n";
|
||||
print "XID : $xid\n";
|
||||
print "UUID : $uuid\n";
|
||||
print "Unique ID : $unique_id\n";
|
||||
print "Handler Name : $strings[0]\n";
|
||||
print "DB : $strings[1]\n";
|
||||
print "Name : $strings[2]\n";
|
||||
print "From Handler : $strings[3]\n";
|
||||
print "From DB : $strings[4]\n";
|
||||
print "From Name : $strings[5]\n";
|
||||
print "Temp/Extra : $strings[6]\n";
|
||||
}
|
||||
|
||||
close $fh;
|
Reference in New Issue
Block a user