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
a938da53
Commit
a938da53
authored
Sep 30, 2008
by
Gleb Shchepa
Browse files
Options
Browse Files
Download
Plain Diff
manual merge 5.0-bugteam --> 5.1-bugteam
parents
3bf44a86
e20b9de1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
11 deletions
+39
-11
sql/parse_file.cc
sql/parse_file.cc
+21
-3
sql/parse_file.h
sql/parse_file.h
+3
-2
sql/sql_db.cc
sql/sql_db.cc
+13
-4
sql/sql_view.cc
sql/sql_view.cc
+2
-2
No files found.
sql/parse_file.cc
View file @
a938da53
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
#include <my_sys.h>
#include <my_sys.h>
#include <my_dir.h>
#include <my_dir.h>
/* from sql_db.cc */
extern
long
mysql_rm_arc_files
(
THD
*
thd
,
MY_DIR
*
dirp
,
const
char
*
org_path
);
/**
/**
Write string with escaping.
Write string with escaping.
...
@@ -282,8 +285,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
...
@@ -282,8 +285,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
// archive copies management
path
[
path_end
]
=
'\0'
;
path
[
path_end
]
=
'\0'
;
#ifdef FRM_ARCHIVE
// archive copies management: disabled unused feature (see bug #17823).
if
(
!
access
(
path
,
F_OK
))
if
(
!
access
(
path
,
F_OK
))
{
{
if
(
old_version
!=
ULONGLONG_MAX
&&
max_versions
!=
0
)
if
(
old_version
!=
ULONGLONG_MAX
&&
max_versions
!=
0
)
...
@@ -330,6 +334,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
...
@@ -330,6 +334,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
}
}
}
}
}
}
#endif//FRM_ARCHIVE
{
{
// rename temporary file
// rename temporary file
...
@@ -352,6 +357,7 @@ err_w_file:
...
@@ -352,6 +357,7 @@ err_w_file:
/**
/**
Renames a frm file (including backups) in same schema.
Renames a frm file (including backups) in same schema.
@thd thread handler
@param schema name of given schema
@param schema name of given schema
@param old_name original file name
@param old_name original file name
@param new_name new file name
@param new_name new file name
...
@@ -363,7 +369,8 @@ err_w_file:
...
@@ -363,7 +369,8 @@ err_w_file:
@retval
@retval
1 Error (only if renaming of frm failed)
1 Error (only if renaming of frm failed)
*/
*/
my_bool
rename_in_schema_file
(
const
char
*
schema
,
const
char
*
old_name
,
my_bool
rename_in_schema_file
(
THD
*
thd
,
const
char
*
schema
,
const
char
*
old_name
,
const
char
*
new_name
,
ulonglong
revision
,
const
char
*
new_name
,
ulonglong
revision
,
uint
num_view_backups
)
uint
num_view_backups
)
{
{
...
@@ -377,9 +384,10 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
...
@@ -377,9 +384,10 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
if
(
my_rename
(
old_path
,
new_path
,
MYF
(
MY_WME
)))
if
(
my_rename
(
old_path
,
new_path
,
MYF
(
MY_WME
)))
return
1
;
return
1
;
/* check if arc_dir exists */
/* check if arc_dir exists
: disabled unused feature (see bug #17823).
*/
build_table_filename
(
arc_path
,
sizeof
(
arc_path
)
-
1
,
schema
,
"arc"
,
""
,
0
);
build_table_filename
(
arc_path
,
sizeof
(
arc_path
)
-
1
,
schema
,
"arc"
,
""
,
0
);
#ifdef FRM_ARCHIVE
if
(
revision
>
0
&&
!
access
(
arc_path
,
F_OK
))
if
(
revision
>
0
&&
!
access
(
arc_path
,
F_OK
))
{
{
char
old_name_buf
[
FN_REFLEN
],
new_name_buf
[
FN_REFLEN
];
char
old_name_buf
[
FN_REFLEN
],
new_name_buf
[
FN_REFLEN
];
...
@@ -400,6 +408,16 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
...
@@ -400,6 +408,16 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
my_rename
(
old_path
,
new_path
,
MYF
(
0
));
my_rename
(
old_path
,
new_path
,
MYF
(
0
));
}
}
}
}
#else//FRM_ARCHIVE
{
// remove obsolete 'arc' directory and files if any
MY_DIR
*
new_dirp
;
if
((
new_dirp
=
my_dir
(
arc_path
,
MYF
(
MY_DONT_SORT
))))
{
DBUG_PRINT
(
"my"
,(
"Archive subdir found: %s"
,
arc_path
));
(
void
)
mysql_rm_arc_files
(
thd
,
new_dirp
,
arc_path
);
}
}
#endif//FRM_ARCHIVE
return
0
;
return
0
;
}
}
...
...
sql/parse_file.h
View file @
a938da53
...
@@ -82,8 +82,9 @@ my_bool
...
@@ -82,8 +82,9 @@ my_bool
sql_create_definition_file
(
const
LEX_STRING
*
dir
,
const
LEX_STRING
*
file_name
,
sql_create_definition_file
(
const
LEX_STRING
*
dir
,
const
LEX_STRING
*
file_name
,
const
LEX_STRING
*
type
,
const
LEX_STRING
*
type
,
uchar
*
base
,
File_option
*
parameters
,
uint
versions
);
uchar
*
base
,
File_option
*
parameters
,
uint
versions
);
my_bool
rename_in_schema_file
(
const
char
*
schema
,
const
char
*
old_name
,
my_bool
rename_in_schema_file
(
THD
*
thd
,
const
char
*
new_name
,
ulonglong
revision
,
const
char
*
schema
,
const
char
*
old_name
,
const
char
*
new_name
,
ulonglong
revision
,
uint
num_view_backups
);
uint
num_view_backups
);
class
File_parser
:
public
Sql_alloc
class
File_parser
:
public
Sql_alloc
...
...
sql/sql_db.cc
View file @
a938da53
...
@@ -37,7 +37,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
...
@@ -37,7 +37,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const
char
*
db
,
const
char
*
path
,
uint
level
,
const
char
*
db
,
const
char
*
path
,
uint
level
,
TABLE_LIST
**
dropped_tables
);
TABLE_LIST
**
dropped_tables
);
static
long
mysql_rm_arc_files
(
THD
*
thd
,
MY_DIR
*
dirp
,
const
char
*
org_path
);
long
mysql_rm_arc_files
(
THD
*
thd
,
MY_DIR
*
dirp
,
const
char
*
org_path
);
static
my_bool
rm_dir_w_symlink
(
const
char
*
org_path
,
my_bool
send_error
);
static
my_bool
rm_dir_w_symlink
(
const
char
*
org_path
,
my_bool
send_error
);
static
void
mysql_change_db_impl
(
THD
*
thd
,
static
void
mysql_change_db_impl
(
THD
*
thd
,
LEX_STRING
*
new_db_name
,
LEX_STRING
*
new_db_name
,
...
@@ -1096,7 +1096,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
...
@@ -1096,7 +1096,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
else
if
(
file
->
name
[
0
]
==
'a'
&&
file
->
name
[
1
]
==
'r'
&&
else
if
(
file
->
name
[
0
]
==
'a'
&&
file
->
name
[
1
]
==
'r'
&&
file
->
name
[
2
]
==
'c'
&&
file
->
name
[
3
]
==
'\0'
)
file
->
name
[
2
]
==
'c'
&&
file
->
name
[
3
]
==
'\0'
)
{
{
/* .frm archive */
/* .frm archive:
Those archives are obsolete, but following code should
exist to remove existent "arc" directories.
See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
char
newpath
[
FN_REFLEN
];
char
newpath
[
FN_REFLEN
];
MY_DIR
*
new_dirp
;
MY_DIR
*
new_dirp
;
strxmov
(
newpath
,
org_path
,
"/"
,
"arc"
,
NullS
);
strxmov
(
newpath
,
org_path
,
"/"
,
"arc"
,
NullS
);
...
@@ -1260,9 +1264,13 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
...
@@ -1260,9 +1264,13 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
RETURN
RETURN
> 0 number of removed files
> 0 number of removed files
-1 error
-1 error
NOTE
A support of "arc" directories is obsolete, however this
function should exist to remove existent "arc" directories.
See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
*/
static
long
mysql_rm_arc_files
(
THD
*
thd
,
MY_DIR
*
dirp
,
long
mysql_rm_arc_files
(
THD
*
thd
,
MY_DIR
*
dirp
,
const
char
*
org_path
)
const
char
*
org_path
)
{
{
long
deleted
=
0
;
long
deleted
=
0
;
ulong
found_other_files
=
0
;
ulong
found_other_files
=
0
;
...
@@ -1304,6 +1312,7 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
...
@@ -1304,6 +1312,7 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
{
{
goto
err
;
goto
err
;
}
}
deleted
++
;
}
}
if
(
thd
->
killed
)
if
(
thd
->
killed
)
goto
err
;
goto
err
;
...
...
sql/sql_view.cc
View file @
a938da53
...
@@ -1947,7 +1947,7 @@ mysql_rename_view(THD *thd,
...
@@ -1947,7 +1947,7 @@ mysql_rename_view(THD *thd,
goto
err
;
goto
err
;
/* rename view and it's backups */
/* rename view and it's backups */
if
(
rename_in_schema_file
(
view
->
db
,
view
->
table_name
,
new_name
,
if
(
rename_in_schema_file
(
thd
,
view
->
db
,
view
->
table_name
,
new_name
,
view_def
.
revision
-
1
,
num_view_backups
))
view_def
.
revision
-
1
,
num_view_backups
))
goto
err
;
goto
err
;
...
@@ -1967,7 +1967,7 @@ mysql_rename_view(THD *thd,
...
@@ -1967,7 +1967,7 @@ mysql_rename_view(THD *thd,
num_view_backups
))
num_view_backups
))
{
{
/* restore renamed view in case of error */
/* restore renamed view in case of error */
rename_in_schema_file
(
view
->
db
,
new_name
,
view
->
table_name
,
rename_in_schema_file
(
thd
,
view
->
db
,
new_name
,
view
->
table_name
,
view_def
.
revision
-
1
,
num_view_backups
);
view_def
.
revision
-
1
,
num_view_backups
);
goto
err
;
goto
err
;
}
}
...
...
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