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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ddbdc16a
Commit
ddbdc16a
authored
Aug 17, 2006
by
mikael/pappa@dator5.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge dator5.(none):/home/pappa/bug21350
into dator5.(none):/home/pappa/bug21388
parents
6c46aa7b
85b3ac68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
25 deletions
+76
-25
mysql-test/r/partition.result
mysql-test/r/partition.result
+9
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+18
-0
sql/ha_partition.cc
sql/ha_partition.cc
+44
-20
sql/ha_partition.h
sql/ha_partition.h
+5
-5
No files found.
mysql-test/r/partition.result
View file @
ddbdc16a
...
@@ -42,6 +42,15 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
...
@@ -42,6 +42,15 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
drop table t1;
create table t1 (a int)
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by list (a)
partition by list (a)
(partition p0 values in (1));
(partition p0 values in (1));
create procedure pz()
create procedure pz()
...
...
mysql-test/t/partition.test
View file @
ddbdc16a
...
@@ -50,6 +50,24 @@ insert into t1 values (NULL), (NULL), (NULL), (NULL);
...
@@ -50,6 +50,24 @@ insert into t1 values (NULL), (NULL), (NULL), (NULL);
show
table
status
;
show
table
status
;
drop
table
t1
;
drop
table
t1
;
#
# Bug 21350: Data Directory problems
#
--
error
1103
create
table
t1
(
a
int
)
partition
by
key
(
a
)
(
partition
p0
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
#
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
--
error
1103
create
table
t1
(
a
int
)
partition
by
key
(
a
)
(
partition
p0
,
partition
p1
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
#
#
# Bug 19309 Partitions: Crash if double procedural alter
# Bug 19309 Partitions: Crash if double procedural alter
#
#
...
...
sql/ha_partition.cc
View file @
ddbdc16a
...
@@ -1134,7 +1134,9 @@ int ha_partition::prepare_new_partition(TABLE *table,
...
@@ -1134,7 +1134,9 @@ int ha_partition::prepare_new_partition(TABLE *table,
bool
open_flag
=
FALSE
;
bool
open_flag
=
FALSE
;
DBUG_ENTER
(
"prepare_new_partition"
);
DBUG_ENTER
(
"prepare_new_partition"
);
set_up_table_before_create
(
table
,
part_name
,
create_info
,
0
,
p_elem
);
if
((
error
=
set_up_table_before_create
(
table
,
part_name
,
create_info
,
0
,
p_elem
)))
goto
error
;
if
((
error
=
file
->
create
(
part_name
,
table
,
create_info
)))
if
((
error
=
file
->
create
(
part_name
,
table
,
create_info
)))
goto
error
;
goto
error
;
create_flag
=
TRUE
;
create_flag
=
TRUE
;
...
@@ -1633,7 +1635,7 @@ uint ha_partition::del_ren_cre_table(const char *from,
...
@@ -1633,7 +1635,7 @@ uint ha_partition::del_ren_cre_table(const char *from,
char
from_buff
[
FN_REFLEN
],
to_buff
[
FN_REFLEN
];
char
from_buff
[
FN_REFLEN
],
to_buff
[
FN_REFLEN
];
char
*
name_buffer_ptr
;
char
*
name_buffer_ptr
;
uint
i
;
uint
i
;
handler
**
file
;
handler
**
file
,
**
abort_file
;
DBUG_ENTER
(
"del_ren_cre_table()"
);
DBUG_ENTER
(
"del_ren_cre_table()"
);
if
(
get_from_handler_file
(
from
,
current_thd
->
mem_root
))
if
(
get_from_handler_file
(
from
,
current_thd
->
mem_root
))
...
@@ -1657,8 +1659,10 @@ uint ha_partition::del_ren_cre_table(const char *from,
...
@@ -1657,8 +1659,10 @@ uint ha_partition::del_ren_cre_table(const char *from,
error
=
(
*
file
)
->
delete_table
((
const
char
*
)
from_buff
);
error
=
(
*
file
)
->
delete_table
((
const
char
*
)
from_buff
);
else
else
{
{
set_up_table_before_create
(
table_arg
,
from_buff
,
create_info
,
i
,
NULL
);
if
((
error
=
set_up_table_before_create
(
table_arg
,
from_buff
,
error
=
(
*
file
)
->
create
(
from_buff
,
table_arg
,
create_info
);
create_info
,
i
,
NULL
))
||
((
error
=
(
*
file
)
->
create
(
from_buff
,
table_arg
,
create_info
))))
goto
create_error
;
}
}
name_buffer_ptr
=
strend
(
name_buffer_ptr
)
+
1
;
name_buffer_ptr
=
strend
(
name_buffer_ptr
)
+
1
;
if
(
error
)
if
(
error
)
...
@@ -1666,6 +1670,16 @@ uint ha_partition::del_ren_cre_table(const char *from,
...
@@ -1666,6 +1670,16 @@ uint ha_partition::del_ren_cre_table(const char *from,
i
++
;
i
++
;
}
while
(
*
(
++
file
));
}
while
(
*
(
++
file
));
DBUG_RETURN
(
save_error
);
DBUG_RETURN
(
save_error
);
create_error:
name_buffer_ptr
=
m_name_buffer_ptr
;
for
(
abort_file
=
file
,
file
=
m_file
;
file
<
abort_file
;
file
++
)
{
create_partition_name
(
from_buff
,
from
,
name_buffer_ptr
,
NORMAL_PART_NAME
,
FALSE
);
VOID
((
*
file
)
->
delete_table
((
const
char
*
)
from_buff
));
name_buffer_ptr
=
strend
(
name_buffer_ptr
)
+
1
;
}
DBUG_RETURN
(
error
);
}
}
/*
/*
...
@@ -1720,7 +1734,8 @@ partition_element *ha_partition::find_partition_element(uint part_id)
...
@@ -1720,7 +1734,8 @@ partition_element *ha_partition::find_partition_element(uint part_id)
part_id Partition id of partition to set-up
part_id Partition id of partition to set-up
RETURN VALUE
RETURN VALUE
NONE
TRUE Error
FALSE Success
DESCRIPTION
DESCRIPTION
Set up
Set up
...
@@ -1730,31 +1745,40 @@ partition_element *ha_partition::find_partition_element(uint part_id)
...
@@ -1730,31 +1745,40 @@ partition_element *ha_partition::find_partition_element(uint part_id)
4) Data file name on partition
4) Data file name on partition
*/
*/
void
ha_partition
::
set_up_table_before_create
(
TABLE
*
table
,
int
ha_partition
::
set_up_table_before_create
(
TABLE
*
table
,
const
char
*
partition_name_with_path
,
const
char
*
partition_name_with_path
,
HA_CREATE_INFO
*
info
,
HA_CREATE_INFO
*
info
,
uint
part_id
,
uint
part_id
,
partition_element
*
part_elem
)
partition_element
*
part_elem
)
{
{
int
error
=
0
;
const
char
*
partition_name
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"set_up_table_before_create"
);
if
(
!
part_elem
)
if
(
!
part_elem
)
{
{
part_elem
=
find_partition_element
(
part_id
);
part_elem
=
find_partition_element
(
part_id
);
if
(
!
part_elem
)
if
(
!
part_elem
)
return
;
// Fatal error
DBUG_RETURN
(
1
);
// Fatal error
}
}
table
->
s
->
max_rows
=
part_elem
->
part_max_rows
;
table
->
s
->
max_rows
=
part_elem
->
part_max_rows
;
table
->
s
->
min_rows
=
part_elem
->
part_min_rows
;
table
->
s
->
min_rows
=
part_elem
->
part_min_rows
;
const
char
*
partition_name
=
strrchr
(
partition_name_with_path
,
FN_LIBCHAR
);
partition_name
=
strrchr
(
partition_name_with_path
,
FN_LIBCHAR
);
if
(
part_elem
->
index_file_name
)
if
((
part_elem
->
index_file_name
&&
append_file_to_dir
(
current_thd
,
(
error
=
append_file_to_dir
(
thd
,
(
const
char
**
)
&
part_elem
->
index_file_name
,
(
const
char
**
)
&
part_elem
->
index_file_name
,
partition_name
+
1
);
partition_name
+
1
)))
||
if
(
part_elem
->
data_file_name
)
(
part_elem
->
data_file_name
&&
append_file_to_dir
(
current_thd
,
(
error
=
append_file_to_dir
(
thd
,
(
const
char
**
)
&
part_elem
->
data_file_name
,
(
const
char
**
)
&
part_elem
->
data_file_name
,
partition_name
+
1
);
partition_name
+
1
))))
{
DBUG_RETURN
(
error
);
}
info
->
index_file_name
=
part_elem
->
index_file_name
;
info
->
index_file_name
=
part_elem
->
index_file_name
;
info
->
data_file_name
=
part_elem
->
data_file_name
;
info
->
data_file_name
=
part_elem
->
data_file_name
;
DBUG_RETURN
(
0
);
}
}
...
...
sql/ha_partition.h
View file @
ddbdc16a
...
@@ -222,11 +222,11 @@ private:
...
@@ -222,11 +222,11 @@ private:
bool
new_handlers_from_part_info
(
MEM_ROOT
*
mem_root
);
bool
new_handlers_from_part_info
(
MEM_ROOT
*
mem_root
);
bool
create_handlers
(
MEM_ROOT
*
mem_root
);
bool
create_handlers
(
MEM_ROOT
*
mem_root
);
void
clear_handler_file
();
void
clear_handler_file
();
void
set_up_table_before_create
(
TABLE
*
table_arg
,
int
set_up_table_before_create
(
TABLE
*
table_arg
,
const
char
*
partition_name_with_path
,
const
char
*
partition_name_with_path
,
HA_CREATE_INFO
*
info
,
HA_CREATE_INFO
*
info
,
uint
part_id
,
uint
part_id
,
partition_element
*
p_elem
);
partition_element
*
p_elem
);
partition_element
*
find_partition_element
(
uint
part_id
);
partition_element
*
find_partition_element
(
uint
part_id
);
public:
public:
...
...
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