Skip to content
Permalink
Browse files

Merge 10.3 into 10.4

  • Loading branch information...
dr-m committed Jul 2, 2019
2 parents faeaf97 + 1d45b3b commit 7a3d34d6456ed719da62a896e5ac6e983b72f3d8
Showing 323 changed files with 23,251 additions and 8,046 deletions.
@@ -1,18 +1,117 @@
SpaceBeforeAssignmentOperators: false
SpaceAfterCStyleCast: true

BreakBeforeBraces: Custom
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...
@@ -4636,8 +4636,16 @@ void do_perl(struct st_command *command)

str_to_file(temp_file_path, ds_script.str, ds_script.length);

/* Use the same perl executable as the one that runs mysql-test-run.pl */
const char *mtr_perl=getenv("MTR_PERL");
if (!mtr_perl)
mtr_perl="perl";

/* Format the "perl <filename>" command */
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
if (strchr(mtr_perl, ' '))
my_snprintf(buf, sizeof(buf), "\"%s\" %s", mtr_perl, temp_file_path);
else
my_snprintf(buf, sizeof(buf), "%s %s", mtr_perl, temp_file_path);

if (!(res_file= my_popen(buf, "r")))
{
@@ -75,6 +75,8 @@ ulong srv_page_size;
ulong srv_page_size_shift;
/* Current page number (0 based). */
unsigned long long cur_page_num;
/* Current space. */
unsigned long long cur_space;
/* Skip the checksum verification. */
static bool no_check;
/* Enabled for strict checksum verification. */
@@ -282,7 +284,9 @@ static void init_page_size(const byte* buf)
+ FSP_SPACE_FLAGS);

if (fil_space_t::full_crc32(flags)) {
srv_page_size = fil_space_t::logical_size(flags);
const ulong ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize;
srv_page_size = 512U << ssize;
physical_page_size = srv_page_size;
return;
}
@@ -424,6 +428,27 @@ ulint read_file(
return bytes;
}

/** Check whether the page contains all zeroes.
@param[in] buf page
@param[in] size physical size of the page
@return true if the page is all zeroes; else false */
static bool is_page_all_zeroes(
byte* buf,
ulint size)
{
/* On pages that are not all zero, the page number
must match. */
const ulint* p = reinterpret_cast<const ulint*>(buf);
const ulint* const end = reinterpret_cast<const ulint*>(buf + size);
do {
if (*p++) {
return false;
}
} while (p != end);

return true;
}

/** Check if page is corrupted or not.
@param[in] buf page frame
@param[in] is_encrypted true if page0 contained cryp_data
@@ -451,6 +476,26 @@ is_page_corrupted(
ulint is_compressed = fil_space_t::is_compressed(flags);
const bool use_full_crc32 = fil_space_t::full_crc32(flags);

if (mach_read_from_4(buf + FIL_PAGE_OFFSET) != cur_page_num
|| (space_id != cur_space
&& (!use_full_crc32 || (!is_encrypted && !is_compressed)))) {
/* On pages that are not all zero, the page number
must match. */
if (is_page_all_zeroes(buf,
fil_space_t::physical_size(flags))) {
return false;
}

if (is_log_enabled) {
fprintf(log_file,
"page id mismatch space::" ULINTPF
" page::%llu \n",
space_id, cur_page_num);
}

return true;
}

/* We can't trust only a page type, thus we take account
also fsp_flags or crypt_data on page 0 */
if ((page_type == FIL_PAGE_PAGE_COMPRESSED && is_compressed) ||
@@ -1539,9 +1584,6 @@ int main(
FILE* fil_page_type = NULL;
fpos_t pos;

/* Use to check the space id of given file. If space_id is zero,
then check whether page is doublewrite buffer.*/
ulint space_id = 0UL;
/* enable when space_id of given file is zero. */
bool is_system_tablespace = false;

@@ -1663,17 +1705,18 @@ int main(
/* enable variable is_system_tablespace when space_id of given
file is zero. Use to skip the checksum verification and rewrite
for doublewrite pages. */
is_system_tablespace = (!memcmp(&space_id, buf +
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 4))
? true : false;
cur_space = mach_read_from_4(buf + FIL_PAGE_SPACE_ID);
cur_page_num = mach_read_from_4(buf + FIL_PAGE_OFFSET);

/* Determine page size, zip_size and page compression
from fsp_flags and encryption metadata from page 0 */
init_page_size(buf);

ulint flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf);

if (physical_page_size > UNIV_ZIP_SIZE_MIN) {
if (physical_page_size == UNIV_ZIP_SIZE_MIN) {
partial_page_read = false;
} else {
/* Read rest of the page 0 to determine crypt_data */
bytes = read_file(buf, partial_page_read, physical_page_size, fil_in);
if (bytes != physical_page_size) {
@@ -1688,6 +1731,7 @@ int main(
partial_page_read = false;
}


/* Now that we have full page 0 in buffer, check encryption */
bool is_encrypted = check_encryption(filename, buf);

@@ -1764,6 +1808,36 @@ int main(
}
}

off_t cur_offset = 0;
/* Find the first non all-zero page and fetch the
space id from there. */
while (is_page_all_zeroes(buf, physical_page_size)) {
bytes = ulong(read_file(
buf, false, physical_page_size,
fil_in));

if (feof(fil_in)) {
fprintf(stderr, "All are "
"zero-filled pages.");
goto my_exit;
}

cur_offset++;
}

cur_space = mach_read_from_4(buf + FIL_PAGE_SPACE_ID);
is_system_tablespace = (cur_space == 0);

if (cur_offset > 0) {
/* Re-read the non-zero page to check the
checksum. So move the file pointer to
previous position and reset the page number too. */
cur_page_num = mach_read_from_4(buf + FIL_PAGE_OFFSET);
if (!start_page) {
goto first_non_zero;
}
}

/* seek to the necessary position */
if (start_page) {
if (!read_from_stdin) {
@@ -1856,6 +1930,7 @@ int main(
goto my_exit;
}

first_non_zero:
if (is_system_tablespace) {
/* enable when page is double write buffer.*/
skip_page = is_page_doublewritebuffer(buf);
@@ -3810,7 +3810,7 @@ open_or_create_log_file(
fil_space_t* space,
ulint i) /*!< in: log file number in group */
{
char name[10000];
char name[FN_REFLEN];
ulint dirnamelen;

os_normalize_path(srv_log_group_home_dir);
@@ -1,5 +1,5 @@
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
Copyright (c) 2009, 2013, Monty Program Ab.
Copyright (c) 2009, 2019, MariaDB Corporation.
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
@@ -286,7 +286,6 @@ extern int maria_close(MARIA_HA *file);
extern int maria_delete(MARIA_HA *file, const uchar *buff);
extern MARIA_HA *maria_open(const char *name, int mode,
uint wait_if_locked);
extern MARIA_HA *maria_clone(struct st_maria_share *share, int mode);
extern int maria_panic(enum ha_panic_function function);
extern int maria_rfirst(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rkey(MARIA_HA *file, uchar *buf, int inx,
@@ -36,6 +36,21 @@ use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;

use Term::ANSIColor;

my %color_map = qw/pass green
retry-pass green
fail red
retry-fail red
disabled bright_black
skipped yellow
reset reset/;
sub xterm_color {
if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
syswrite STDOUT, color($color_map{$_[0]});
}
}

my $tot_real_time= 0;

our $timestamp= 0;
@@ -498,7 +513,16 @@ sub mtr_print (@) {
sub mtr_report (@) {
if (defined $verbose)
{
print _name(). join(" ", @_). "\n";
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
xterm_color($s[1]);
print "[ $s[1] ]";
xterm_color('reset');
print $s[2];
} else {
print $s[0];
}
}
}

0 comments on commit 7a3d34d

Please sign in to comment.
You can’t perform that action at this time.