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
5a20f2d0
Commit
5a20f2d0
authored
Feb 13, 2006
by
mikron@mikael-ronstr-ms-dator.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL 2826: Error handling of ALTER TABLE for partitioning
Introduce log entry to handle replace of frm file
parent
12647d73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
9 deletions
+21
-9
sql/handler.h
sql/handler.h
+2
-1
sql/sql_partition.cc
sql/sql_partition.cc
+14
-8
sql/sql_table.cc
sql/sql_table.cc
+5
-0
No files found.
sql/handler.h
View file @
5a20f2d0
...
@@ -852,6 +852,7 @@ public:
...
@@ -852,6 +852,7 @@ public:
st_table_log_memory_entry
*
first_log_entry
;
st_table_log_memory_entry
*
first_log_entry
;
st_table_log_memory_entry
*
exec_log_entry
;
st_table_log_memory_entry
*
exec_log_entry
;
st_table_log_memory_entry
*
frm_log_entry
;
/*
/*
A bitmap of partitions used by the current query.
A bitmap of partitions used by the current query.
Usage pattern:
Usage pattern:
...
@@ -963,7 +964,7 @@ public:
...
@@ -963,7 +964,7 @@ public:
part_field_array
(
NULL
),
subpart_field_array
(
NULL
),
part_field_array
(
NULL
),
subpart_field_array
(
NULL
),
full_part_field_array
(
NULL
),
full_part_field_array
(
NULL
),
part_expr
(
NULL
),
subpart_expr
(
NULL
),
item_free_list
(
NULL
),
part_expr
(
NULL
),
subpart_expr
(
NULL
),
item_free_list
(
NULL
),
first_log_entry
(
NULL
),
exec_log_entry
(
NULL
),
first_log_entry
(
NULL
),
exec_log_entry
(
NULL
),
frm_log_entry
(
NULL
),
list_array
(
NULL
),
list_array
(
NULL
),
part_info_string
(
NULL
),
part_info_string
(
NULL
),
part_func_string
(
NULL
),
subpart_func_string
(
NULL
),
part_func_string
(
NULL
),
subpart_func_string
(
NULL
),
...
...
sql/sql_partition.cc
View file @
5a20f2d0
...
@@ -5109,7 +5109,7 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry)
...
@@ -5109,7 +5109,7 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry)
/*
/*
Log an delete/rename frm file
Log an delete/rename frm file
SYNOPSIS
SYNOPSIS
write_log_re
nam
e_delete_frm()
write_log_re
plac
e_delete_frm()
lpt Struct for parameters
lpt Struct for parameters
next_entry Next reference to use in log record
next_entry Next reference to use in log record
path Name to rename from
path Name to rename from
...
@@ -5118,30 +5118,30 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry)
...
@@ -5118,30 +5118,30 @@ release_part_info_log_entries(TABLE_LOG_MEMORY_ENTRY *log_entry)
TRUE Error
TRUE Error
FALSE Success
FALSE Success
DESCRIPTION
DESCRIPTION
Support routine that writes a re
nam
e or delete of an frm file into the
Support routine that writes a re
plac
e or delete of an frm file into the
table log. It also inserts an entry that keeps track of used space into
table log. It also inserts an entry that keeps track of used space into
the partition info object
the partition info object
*/
*/
bool
bool
write_log_re
nam
e_delete_frm
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
,
write_log_re
plac
e_delete_frm
(
ALTER_PARTITION_PARAM_TYPE
*
lpt
,
uint
next_entry
,
uint
next_entry
,
const
char
*
from_path
,
const
char
*
from_path
,
const
char
*
to_path
,
const
char
*
to_path
,
bool
re
nam
e_flag
)
bool
re
plac
e_flag
)
{
{
TABLE_LOG_ENTRY
table_log_entry
;
TABLE_LOG_ENTRY
table_log_entry
;
TABLE_LOG_MEMORY_ENTRY
*
log_entry
;
TABLE_LOG_MEMORY_ENTRY
*
log_entry
;
DBUG_ENTER
(
"write_log_re
nam
e_frm"
);
DBUG_ENTER
(
"write_log_re
plac
e_frm"
);
if
(
re
nam
e_flag
)
if
(
re
plac
e_flag
)
table_log_entry
.
action_type
=
TLOG_RE
NAM
E_ACTION_CODE
;
table_log_entry
.
action_type
=
TLOG_RE
PLAC
E_ACTION_CODE
;
else
else
table_log_entry
.
action_type
=
TLOG_DELETE_ACTION_CODE
;
table_log_entry
.
action_type
=
TLOG_DELETE_ACTION_CODE
;
table_log_entry
.
next_entry
=
next_entry
;
table_log_entry
.
next_entry
=
next_entry
;
table_log_entry
.
handler_type
=
"frm"
;
table_log_entry
.
handler_type
=
"frm"
;
table_log_entry
.
name
=
to_path
;
table_log_entry
.
name
=
to_path
;
if
(
re
nam
e_flag
)
if
(
re
plac
e_flag
)
table_log_entry
.
from_name
=
from_path
;
table_log_entry
.
from_name
=
from_path
;
if
(
write_table_log_entry
(
&
table_log_entry
,
&
log_entry
))
if
(
write_table_log_entry
(
&
table_log_entry
,
&
log_entry
))
{
{
...
@@ -5468,6 +5468,7 @@ write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5468,6 +5468,7 @@ write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
if
(
write_log_rename_delete_frm
(
lpt
,
0UL
,
path
,
shadow_path
,
FALSE
))
if
(
write_log_rename_delete_frm
(
lpt
,
0UL
,
path
,
shadow_path
,
FALSE
))
break
;
break
;
log_entry
=
part_info
->
first_log_entry
;
log_entry
=
part_info
->
first_log_entry
;
part_info
->
frm_log_entry
=
log_entry
;
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
FALSE
,
&
exec_log_entry
))
FALSE
,
&
exec_log_entry
))
break
;
break
;
...
@@ -5478,6 +5479,7 @@ write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5478,6 +5479,7 @@ write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
release_part_info_log_entries
(
part_info
->
first_log_entry
);
release_part_info_log_entries
(
part_info
->
first_log_entry
);
unlock_global_table_log
();
unlock_global_table_log
();
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
frm_log_entry
=
NULL
;
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
@@ -5527,6 +5529,7 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5527,6 +5529,7 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
(
const
char
*
)
tmp_path
,
TRUE
))
(
const
char
*
)
tmp_path
,
TRUE
))
break
;
break
;
log_entry
=
part_info
->
first_log_entry
;
log_entry
=
part_info
->
first_log_entry
;
part_info
->
frm_log_entry
=
log_entry
;
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
FALSE
,
&
exec_log_entry
))
FALSE
,
&
exec_log_entry
))
break
;
break
;
...
@@ -5537,6 +5540,7 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5537,6 +5540,7 @@ write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
release_part_info_log_entries
(
part_info
->
first_log_entry
);
release_part_info_log_entries
(
part_info
->
first_log_entry
);
unlock_global_table_log
();
unlock_global_table_log
();
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
frm_log_entry
=
NULL
;
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
@@ -5646,6 +5650,7 @@ write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5646,6 +5650,7 @@ write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
if
(
write_log_rename_delete_frm
(
lpt
,
0UL
,
path
,
shadow_path
,
FALSE
))
if
(
write_log_rename_delete_frm
(
lpt
,
0UL
,
path
,
shadow_path
,
FALSE
))
break
;
break
;
log_entry
=
part_info
->
first_log_entry
;
log_entry
=
part_info
->
first_log_entry
;
part_info
->
frm_log_entry
=
log_entry
;
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
if
(
write_execute_table_log_entry
(
log_entry
->
entry_pos
,
FALSE
,
&
exec_log_entry
))
FALSE
,
&
exec_log_entry
))
break
;
break
;
...
@@ -5656,6 +5661,7 @@ write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
...
@@ -5656,6 +5661,7 @@ write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
release_part_info_log_entries
(
part_info
->
first_log_entry
);
release_part_info_log_entries
(
part_info
->
first_log_entry
);
unlock_global_table_log
();
unlock_global_table_log
();
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
first_log_entry
=
old_first_log_entry
;
part_info
->
frm_log_entry
=
NULL
;
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
my_error
(
ER_TABLE_LOG_ERROR
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
...
sql/sql_table.cc
View file @
5a20f2d0
...
@@ -1136,12 +1136,17 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
...
@@ -1136,12 +1136,17 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
*/
*/
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
my_delete
(
frm_name
,
MYF
(
MY_WME
))
||
if
(
my_delete
(
frm_name
,
MYF
(
MY_WME
))
||
inactivate_table_log_entry
(
part_info
->
frm_log_entry
->
entry_pos
)
||
sync_table_log
()
||
my_rename
(
shadow_frm_name
,
frm_name
,
MYF
(
MY_WME
))
||
my_rename
(
shadow_frm_name
,
frm_name
,
MYF
(
MY_WME
))
||
lpt
->
table
->
file
->
create_handler_files
(
path
,
shadow_path
,
TRUE
))
lpt
->
table
->
file
->
create_handler_files
(
path
,
shadow_path
,
TRUE
))
{
{
error
=
1
;
error
=
1
;
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
inactivate_table_log_entry
(
part_info
->
frm_log_entry
->
entry_pos
);
part_info
->
frm_log_entry
=
NULL
;
VOID
(
sync_table_log
());
}
}
end:
end:
...
...
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