Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dda12311
Commit
dda12311
authored
Oct 05, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dict_table_t::rollback_instant(): Roll back instant ADD COLUMN in the cache
parent
4a2ad0ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
30 deletions
+49
-30
storage/innobase/dict/dict0mem.cc
storage/innobase/dict/dict0mem.cc
+44
-0
storage/innobase/include/dict0mem.h
storage/innobase/include/dict0mem.h
+4
-0
storage/innobase/row/row0uins.cc
storage/innobase/row/row0uins.cc
+1
-30
No files found.
storage/innobase/dict/dict0mem.cc
View file @
dda12311
...
@@ -1131,3 +1131,47 @@ dict_mem_table_is_system(
...
@@ -1131,3 +1131,47 @@ dict_mem_table_is_system(
return
true
;
return
true
;
}
}
}
}
/** Roll back the 'instant ADD' of some columns.
@param[in] n number of surviving non-system columns */
void
dict_table_t
::
rollback_instant
(
unsigned
n
)
{
dict_index_t
*
index
=
indexes
.
start
;
DBUG_ASSERT
(
index
->
is_instant
());
DBUG_ASSERT
(
n
>
index
->
n_uniq
);
DBUG_ASSERT
(
n_cols
>
n
+
DATA_N_SYS_COLS
);
const
unsigned
n_remove
=
n_cols
-
n
-
DATA_N_SYS_COLS
;
char
*
names
=
const_cast
<
char
*>
(
dict_table_get_col_name
(
this
,
n
));
const
char
*
sys
=
names
;
for
(
unsigned
i
=
n_remove
;
i
--
;
)
{
sys
+=
strlen
(
sys
)
+
1
;
}
static
const
char
system
[]
=
"DB_ROW_ID
\0
DB_TRX_ID
\0
DB_ROLL_PTR"
;
DBUG_ASSERT
(
!
memcmp
(
sys
,
system
,
sizeof
system
));
for
(
unsigned
i
=
index
->
n_fields
-
n_remove
;
i
<
index
->
n_fields
;
i
++
)
{
index
->
n_nullable
-=
index
->
fields
[
i
].
col
->
is_nullable
();
}
index
->
n_fields
-=
n_remove
;
memmove
(
names
,
sys
,
sizeof
system
);
memmove
(
cols
+
n
,
cols
+
n_cols
-
DATA_N_SYS_COLS
,
DATA_N_SYS_COLS
*
sizeof
*
cols
);
n_cols
-=
n_remove
;
for
(
unsigned
i
=
DATA_N_SYS_COLS
;
i
--
;
)
{
cols
[
n_cols
-
i
].
ind
--
;
}
if
(
dict_index_is_auto_gen_clust
(
index
))
{
DBUG_ASSERT
(
index
->
n_uniq
==
1
);
dict_field_t
*
field
=
index
->
fields
;
field
->
name
=
sys
;
field
->
col
=
dict_table_get_sys_col
(
this
,
DATA_ROW_ID
);
}
dict_field_t
*
field
=
&
index
->
fields
[
index
->
n_uniq
];
field
->
name
=
sys
+
sizeof
"DB_ROW_ID"
;
field
->
col
=
dict_table_get_sys_col
(
this
,
DATA_TRX_ID
);
field
++
;
field
->
name
=
sys
+
sizeof
"DB_ROW_ID
\0
DB_TRX_ID"
;
field
->
col
=
dict_table_get_sys_col
(
this
,
DATA_ROLL_PTR
);
}
storage/innobase/include/dict0mem.h
View file @
dda12311
...
@@ -1518,6 +1518,10 @@ struct dict_table_t {
...
@@ -1518,6 +1518,10 @@ struct dict_table_t {
return
(
!
(
flags
&
DICT_TF_MASK_ZIP_SSIZE
));
return
(
!
(
flags
&
DICT_TF_MASK_ZIP_SSIZE
));
}
}
/** Roll back the 'instant ADD' of some columns.
@param[in] n number of surviving non-system columns */
void
rollback_instant
(
unsigned
n
);
/** Add the table definition to the data dictionary cache */
/** Add the table definition to the data dictionary cache */
void
add_to_cache
();
void
add_to_cache
();
...
...
storage/innobase/row/row0uins.cc
View file @
dda12311
...
@@ -181,36 +181,7 @@ row_undo_ins_remove_clust_rec(
...
@@ -181,36 +181,7 @@ row_undo_ins_remove_clust_rec(
/* This is the rollback of an instant ADD COLUMN.
/* This is the rollback of an instant ADD COLUMN.
Remove the column from the dictionary cache,
Remove the column from the dictionary cache,
but keep the system columns. */
but keep the system columns. */
char
*
names
=
const_cast
<
char
*>
(
table
->
rollback_instant
(
pos
);
dict_table_get_col_name
(
table
,
pos
));
const
char
*
sys
=
names
+
strlen
(
names
)
+
1
;
static
const
char
system
[]
=
"DB_ROW_ID
\0
DB_TRX_ID
\0
DB_ROLL_PTR"
;
ut_ad
(
!
memcmp
(
sys
,
system
,
sizeof
system
));
index
->
n_nullable
-=
index
->
fields
[
--
index
->
n_fields
]
.
col
->
is_nullable
();
memmove
(
names
,
sys
,
sizeof
system
);
table
->
n_cols
--
;
memmove
(
table
->
cols
+
pos
,
table
->
cols
+
pos
+
1
,
DATA_N_SYS_COLS
*
sizeof
*
table
->
cols
);
for
(
uint
i
=
3
;
i
--
;
)
{
table
->
cols
[
table
->
n_cols
-
i
].
ind
--
;
}
if
(
dict_index_is_auto_gen_clust
(
index
))
{
ut_ad
(
index
->
n_uniq
==
1
);
dict_field_t
*
field
=
index
->
fields
;
field
->
name
=
sys
;
field
->
col
=
dict_table_get_sys_col
(
table
,
DATA_ROW_ID
);
}
dict_field_t
*
field
=
&
index
->
fields
[
index
->
n_uniq
];
field
->
name
=
sys
+
sizeof
"DB_ROW_ID"
;
field
->
col
=
dict_table_get_sys_col
(
table
,
DATA_TRX_ID
);
field
++
;
field
->
name
=
sys
+
sizeof
"DB_ROW_ID
\0
DB_TRX_ID"
;
field
->
col
=
dict_table_get_sys_col
(
table
,
DATA_ROLL_PTR
);
}
}
dict_table_close
(
table
,
true
,
false
);
dict_table_close
(
table
,
true
,
false
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment