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
e222f4d8
Commit
e222f4d8
authored
Feb 01, 2006
by
mikron@mikael-ronstr-ms-dator.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL 2826: A third step, fixing generate_partition_syntax
parent
dc4ba148
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
81 deletions
+20
-81
sql/mysql_priv.h
sql/mysql_priv.h
+15
-0
sql/sql_partition.cc
sql/sql_partition.cc
+5
-81
No files found.
sql/mysql_priv.h
View file @
e222f4d8
...
...
@@ -611,8 +611,15 @@ struct Query_cache_query_flags
#define ERROR_INJECTOR(x)
#define ERROR_INJECTOR_ACTION(x)
#define ERROR_INJECTOR_CRASH(x)
#define SET_ERROR_INJECT_CODE(x)
#define SET_ERROR_INJECT_VALUE(x)
#else
#define SET_ERROR_INJECT_CODE(x) \
current_thd->variables.error_inject_code= (x)
#define SET_ERROR_INJECT_VALUE(x) \
current_thd->variables.error_inject_value= (x)
inline
bool
my_error_inject
(
int
error
)
{
...
...
@@ -632,6 +639,7 @@ my_error_inject(int error)
#define ERROR_INJECT(code) \
(my_error_inject((code)) ? 1 : 0)
#endif
uint
build_table_path
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
const
char
*
table
,
const
char
*
ext
);
void
write_bin_log
(
THD
*
thd
,
bool
clear_error
,
...
...
@@ -1128,7 +1136,14 @@ typedef struct st_lock_param_type
}
ALTER_PARTITION_PARAM_TYPE
;
void
mem_alloc_error
(
size_t
size
);
bool
write_table_log
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
);
bool
write_log_shadow_frm
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
,
bool
install_flag
);
bool
write_log_drop_partition
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
);
bool
write_log_add_partition
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
);
bool
write_log_ph1_change_partition
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
);
bool
write_log_ph2_change_partition
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
);
#define WFRM_WRITE_SHADOW 1
#define WFRM_INSTALL_SHADOW 2
#define WFRM_PACK_FRM
...
...
sql/sql_partition.cc
View file @
e222f4d8
...
...
@@ -2388,15 +2388,10 @@ char *generate_partition_syntax(partition_info *part_info,
char
path
[
FN_REFLEN
];
int
err
=
0
;
List_iterator
<
partition_element
>
part_it
(
part_info
->
partitions
);
List_iterator
<
partition_element
>
temp_it
(
part_info
->
temp_partitions
);
File
fptr
;
char
*
buf
=
NULL
;
//Return buffer
uint
use_temp
=
0
;
uint
no_temp_parts
=
part_info
->
temp_partitions
.
elements
;
bool
write_part_state
;
DBUG_ENTER
(
"generate_partition_syntax"
);
write_part_state
=
(
part_info
->
part_state
&&
!
part_info
->
part_state_len
);
if
(
unlikely
(((
fptr
=
create_temp_file
(
path
,
mysql_tmpdir
,
"psy"
,
0
,
0
)))
<
0
))
DBUG_RETURN
(
NULL
);
#ifndef __WIN__
...
...
@@ -2459,8 +2454,7 @@ char *generate_partition_syntax(partition_info *part_info,
err
+=
add_space
(
fptr
);
}
}
no_parts
=
part_info
->
no_parts
;
tot_no_parts
=
no_parts
+
no_temp_parts
;
tot_no_parts
=
part_info
->
partitions
.
elements
;
no_subparts
=
part_info
->
no_subparts
;
if
(
write_all
||
(
!
part_info
->
use_default_partitions
))
...
...
@@ -2469,57 +2463,10 @@ char *generate_partition_syntax(partition_info *part_info,
i
=
0
;
do
{
/*
We need to do some clever list manipulation here since we have two
different needs for our list processing and here we take some of the
cost of using a simpler list processing for the other parts of the
code.
ALTER TABLE REORGANIZE PARTITIONS has the list of partitions to be
the final list as the main list and the reorganised partitions is in
the temporary partition list. Thus when finding the first part added
we insert the temporary list if there is such a list. If there is no
temporary list we are performing an ADD PARTITION.
*/
if
(
use_temp
&&
use_temp
<=
no_temp_parts
)
part_elem
=
part_it
++
;
if
(
part_elem
->
part_state
!=
PART_TO_BE_DROPPED
&&
part_elem
->
part_state
!=
PART_REORGED_DROPPED
)
{
part_elem
=
temp_it
++
;
DBUG_ASSERT
(
no_temp_parts
);
no_temp_parts
--
;
}
else
if
(
use_temp
)
{
DBUG_ASSERT
(
no_parts
);
part_elem
=
save_part_elem
;
use_temp
=
0
;
no_parts
--
;
}
else
{
part_elem
=
part_it
++
;
if
((
part_elem
->
part_state
==
PART_TO_BE_ADDED
||
part_elem
->
part_state
==
PART_IS_ADDED
)
&&
no_temp_parts
)
{
save_part_elem
=
part_elem
;
part_elem
=
temp_it
++
;
no_temp_parts
--
;
use_temp
=
1
;
}
else
{
DBUG_ASSERT
(
no_parts
);
no_parts
--
;
}
}
if
(
part_elem
->
part_state
!=
PART_IS_DROPPED
)
{
if
(
write_part_state
)
{
uint32
part_state_id
=
part_info
->
part_state_len
;
part_info
->
part_state
[
part_state_id
]
=
(
uchar
)
part_elem
->
part_state
;
part_info
->
part_state_len
=
part_state_id
+
1
;
}
err
+=
add_partition
(
fptr
);
err
+=
add_string
(
fptr
,
part_elem
->
partition_name
);
err
+=
add_space
(
fptr
);
...
...
@@ -2558,7 +2505,6 @@ char *generate_partition_syntax(partition_info *part_info,
if
(
i
==
(
tot_no_parts
-
1
))
err
+=
add_end_parenthesis
(
fptr
);
}
while
(
++
i
<
tot_no_parts
);
DBUG_ASSERT
(
!
no_parts
&&
!
no_temp_parts
);
}
if
(
err
)
goto
close_file
;
...
...
@@ -4576,6 +4522,7 @@ that are reorganised.
my_error
(
ER_ROW_IS_REFERENCED
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
tab_part_info
->
no_parts
-=
no_parts_dropped
;
}
else
if
((
alter_info
->
flags
&
ALTER_OPTIMIZE_PARTITION
)
||
(
alter_info
->
flags
&
ALTER_ANALYZE_PARTITION
)
||
...
...
@@ -5138,29 +5085,6 @@ write_log_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt, bool install_frm)
}
/*
Write the log entries to ensure that the drop partition command is completed
even in the presence of a crash.
SYNOPSIS
write_log_drop_partition()
lpt Struct containing parameters
RETURN VALUES
TRUE Error
FALSE Success
DESCRIPTION
Prepare entries to the table log indicating all partitions to drop and to
install the shadow frm file and remove the old frm file.
*/
bool
write_log_add_partition
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
)
{
DBUG_ENTER
(
"write_log_drop_partition"
);
DBUG_RETURN
(
FALSE
);
}
/*
Write the log entries to ensure that the drop partition command is completed
even in the presence of a crash.
...
...
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