summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-27 20:46:18 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-27 20:46:38 +0200
commit37ab7e45963627f3c1ea2dd43d5b305de37bb16f (patch)
treee07ada7fbde72c438f2a6a6c162e050caf1950f9 /storage
parent30c3d6db328d73f1b30be537aceb55d37936fdb9 (diff)
parent893ebb739e24637985892da1555f2e6f1a8ac5b6 (diff)
downloadmariadb-git-37ab7e45963627f3c1ea2dd43d5b305de37bb16f.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'storage')
-rw-r--r--storage/heap/hp_create.c22
-rw-r--r--storage/innobase/row/row0sel.cc2
-rw-r--r--storage/maria/ma_check.c9
-rw-r--r--storage/maria/ma_ft_boolean_search.c2
-rw-r--r--storage/maria/ma_write.c15
-rw-r--r--storage/xtradb/.clang-format111
-rw-r--r--storage/xtradb/handler/ha_innodb.h3
-rw-r--r--storage/xtradb/log/log0online.cc4
8 files changed, 147 insertions, 21 deletions
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 29c031c466c..21d266f78e5 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB Corporation.
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2018, 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
@@ -98,7 +98,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
/* fall through */
case HA_KEYTYPE_VARTEXT1:
keyinfo->flag|= HA_VAR_LENGTH_KEY;
- length+= 2;
+ /*
+ For BTREE algorithm, key length, greater than or equal
+ to 255, is packed on 3 bytes.
+ */
+ if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
+ length+= size_to_store_key_length(keyinfo->seg[j].length);
+ else
+ length+= 2;
/* Save number of bytes used to store length */
keyinfo->seg[j].bit_start= 1;
break;
@@ -107,7 +114,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
/* fall_through */
case HA_KEYTYPE_VARTEXT2:
keyinfo->flag|= HA_VAR_LENGTH_KEY;
- length+= 2;
+ /*
+ For BTREE algorithm, key length, greater than or equal
+ to 255, is packed on 3 bytes.
+ */
+ if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
+ length+= size_to_store_key_length(keyinfo->seg[j].length);
+ else
+ length+= 2;
/* Save number of bytes used to store length */
keyinfo->seg[j].bit_start= 2;
/*
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index c2954742f8e..8397269d8db 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4550,7 +4550,7 @@ no_gap_lock:
prebuilt->new_rec_locks = 1;
}
err = DB_SUCCESS;
- /* fall through */
+ break;
case DB_SUCCESS:
break;
case DB_LOCK_WAIT:
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index cd8cedeb092..a6efc8a3aa9 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -891,8 +891,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (level > param->max_level)
param->max_level=level;
- if (_ma_get_keynr(share, anc_page->buff) !=
- (uint) (keyinfo - share->keyinfo))
+ if (_ma_get_keynr(share, anc_page->buff) != keyinfo->key_nr)
_ma_check_print_error(param, "Page at %s is not marked for index %u",
llstr(anc_page->pos, llbuff),
(uint) (keyinfo - share->keyinfo));
@@ -916,7 +915,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
info->last_key.keyinfo= tmp_key.keyinfo= keyinfo;
info->lastinx= ~0; /* Safety */
tmp_key.data= tmp_key_buff;
- for ( ;; )
+ for ( ;; _ma_copy_key(&info->last_key, &tmp_key))
{
if (nod_flag)
{
@@ -998,7 +997,6 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
tmp_key.data);
}
}
- _ma_copy_key(&info->last_key, &tmp_key);
(*key_checksum)+= maria_byte_checksum(tmp_key.data, tmp_key.data_length);
record= _ma_row_pos_from_key(&tmp_key);
@@ -5739,8 +5737,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
a_length= share->keypage_header + nod_flag;
key_block->end_pos= anc_buff + share->keypage_header;
bzero(anc_buff, share->keypage_header);
- _ma_store_keynr(share, anc_buff, (uint) (sort_param->keyinfo -
- share->keyinfo));
+ _ma_store_keynr(share, anc_buff, sort_param->keyinfo->key_nr);
lastkey=0; /* No previous key in block */
}
else
diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c
index af2ad6f1ba9..c5cfa550c10 100644
--- a/storage/maria/ma_ft_boolean_search.c
+++ b/storage/maria/ma_ft_boolean_search.c
@@ -457,7 +457,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
*/
ftbw->off=off;
ftbw->key_root= info->cur_row.lastpos;
- ftbw->keyinfo=& info->s->ft2_keyinfo;
+ ftbw->keyinfo= info->last_key.keyinfo= & info->s->ft2_keyinfo;
r= _ma_search_first(info, ftbw->keyinfo, ftbw->key_root);
DBUG_ASSERT(r==0); /* found something */
memcpy(lastkey_buf+off, info->last_key.data,
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index feac1dbf894..1cf8cc6af29 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -664,13 +664,18 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
else
{
/* popular word. two-level tree. going down */
- my_off_t root=dup_key_pos;
- keyinfo= &share->ft2_keyinfo;
- get_key_full_length_rdonly(off, key);
- key+=off;
+ my_off_t root= dup_key_pos;
+ MARIA_KEY subkey;
+ get_key_full_length_rdonly(off, key->data);
+ subkey.keyinfo= keyinfo= &share->ft2_keyinfo;
+ subkey.data= key->data + off;
+ subkey.data_length= key->data_length - off;
+ subkey.ref_length= key->ref_length;
+ subkey.flag= key->flag;
+
/* we'll modify key entry 'in vivo' */
keypos-= keyinfo->keylength + page.node;
- error= _ma_ck_real_write_btree(info, key, &root, comp_flag);
+ error= _ma_ck_real_write_btree(info, &subkey, &root, comp_flag);
_ma_dpointer(share, keypos+HA_FT_WLEN, root);
subkeys--; /* should there be underflow protection ? */
DBUG_ASSERT(subkeys < 0);
diff --git a/storage/xtradb/.clang-format b/storage/xtradb/.clang-format
new file mode 100644
index 00000000000..d757d0a5a05
--- /dev/null
+++ b/storage/xtradb/.clang-format
@@ -0,0 +1,111 @@
+# generated with:
+# clang-format-5.0 -style=Google --dump-config
+
+Language: Cpp
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeCategories:
+ - Regex: '^<.*\.h>'
+ Priority: 1
+ - Regex: '^<.*'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 3
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IndentCaseLabels: true
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+SortUsingDeclarations: true
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Auto
+TabWidth: 8
+
+
+# changes for MySQL 5.x (InnoDB)
+AlignConsecutiveDeclarations: true
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterReturnType: All
+ColumnLimit: 78
+DerivePointerAlignment: false
+IndentWidth: 8
+MaxEmptyLinesToKeep: 2
+PointerAlignment: Right
+ReflowComments: false
+SortIncludes: false
+SpaceAfterCStyleCast: true
+UseTab: Always
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 24fb04093ac..60737914ac1 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -183,8 +183,7 @@ class ha_innobase: public handler
char* norm_name,
char* temp_path,
char* remote_path);
- int create(const char *name, register TABLE *form,
- HA_CREATE_INFO *create_info);
+ int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
int truncate();
int delete_table(const char *name);
int rename_table(const char* from, const char* to);
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index 1e373c8345f..736ef3e3d08 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -1531,10 +1531,10 @@ log_online_open_bitmap_file_read_only(
if (srv_data_home_len
&& srv_data_home[srv_data_home_len-1]
!= SRV_PATH_SEPARATOR) {
- ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%c%s",
+ ut_snprintf(bitmap_file->name, sizeof(bitmap_file->name), "%s%c%s",
srv_data_home, SRV_PATH_SEPARATOR, name);
} else {
- ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s",
+ ut_snprintf(bitmap_file->name, sizeof(bitmap_file->name), "%s%s",
srv_data_home, name);
}
bitmap_file->file