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
7f5d138a
Commit
7f5d138a
authored
Jul 11, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix merge.test: online alter table support for MERGE tables, really
parent
b7e77be5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
14 deletions
+45
-14
include/myisammrg.h
include/myisammrg.h
+2
-1
storage/myisammrg/ha_myisammrg.cc
storage/myisammrg/ha_myisammrg.cc
+39
-10
storage/myisammrg/ha_myisammrg.h
storage/myisammrg/ha_myisammrg.h
+3
-0
storage/myisammrg/myrg_create.c
storage/myisammrg/myrg_create.c
+1
-3
No files found.
include/myisammrg.h
View file @
7f5d138a
...
@@ -31,7 +31,8 @@ extern "C" {
...
@@ -31,7 +31,8 @@ extern "C" {
#include <queues.h>
#include <queues.h>
#define MYRG_NAME_EXT ".MRG"
#define MYRG_NAME_EXT ".MRG"
#define MYRG_NAME_TMPEXT ".MRG_TMP"
/* In which table to INSERT rows */
/* In which table to INSERT rows */
#define MERGE_INSERT_DISABLED 0
#define MERGE_INSERT_DISABLED 0
...
...
storage/myisammrg/ha_myisammrg.cc
View file @
7f5d138a
...
@@ -135,7 +135,7 @@ ha_myisammrg::~ha_myisammrg(void)
...
@@ -135,7 +135,7 @@ ha_myisammrg::~ha_myisammrg(void)
static
const
char
*
ha_myisammrg_exts
[]
=
{
static
const
char
*
ha_myisammrg_exts
[]
=
{
".MRG"
,
MYRG_NAME_EXT
,
NullS
NullS
};
};
extern
int
table2myisam
(
TABLE
*
table_arg
,
MI_KEYDEF
**
keydef_out
,
extern
int
table2myisam
(
TABLE
*
table_arg
,
MI_KEYDEF
**
keydef_out
,
...
@@ -1504,15 +1504,14 @@ err:
...
@@ -1504,15 +1504,14 @@ err:
}
}
int
ha_myisammrg
::
create
(
const
char
*
name
,
register
TABLE
*
form
,
int
ha_myisammrg
::
create_mrg
(
const
char
*
name
,
HA_CREATE_INFO
*
create_info
)
HA_CREATE_INFO
*
create_info
)
{
{
char
buff
[
FN_REFLEN
];
char
buff
[
FN_REFLEN
];
const
char
**
table_names
,
**
pos
;
const
char
**
table_names
,
**
pos
;
TABLE_LIST
*
tables
=
create_info
->
merge_list
.
first
;
TABLE_LIST
*
tables
=
create_info
->
merge_list
.
first
;
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
size_t
dirlgt
=
dirname_length
(
name
);
size_t
dirlgt
=
dirname_length
(
name
);
DBUG_ENTER
(
"ha_myisammrg::create"
);
DBUG_ENTER
(
"ha_myisammrg::create
_mrg
"
);
/* Allocate a table_names array in thread mem_root. */
/* Allocate a table_names array in thread mem_root. */
if
(
!
(
table_names
=
(
const
char
**
)
if
(
!
(
table_names
=
(
const
char
**
)
...
@@ -1560,12 +1559,19 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
...
@@ -1560,12 +1559,19 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
*
pos
=
0
;
*
pos
=
0
;
/* Create a MERGE meta file from the table_names array. */
/* Create a MERGE meta file from the table_names array. */
DBUG_RETURN
(
myrg_create
(
fn_format
(
buff
,
name
,
""
,
""
,
int
res
=
myrg_create
(
name
,
table_names
,
create_info
->
merge_insert_method
,
0
);
MY_RESOLVE_SYMLINKS
|
DBUG_RETURN
(
res
);
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
),
}
table_names
,
create_info
->
merge_insert_method
,
(
my_bool
)
0
));
int
ha_myisammrg
::
create
(
const
char
*
name
,
register
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
)
{
char
buff
[
FN_REFLEN
];
DBUG_ENTER
(
"ha_myisammrg::create"
);
fn_format
(
buff
,
name
,
""
,
MYRG_NAME_EXT
,
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
);
int
res
=
create_mrg
(
buff
,
create_info
);
DBUG_RETURN
(
res
);
}
}
...
@@ -1628,6 +1634,29 @@ ha_myisammrg::check_if_supported_inplace_alter(TABLE *altered_table,
...
@@ -1628,6 +1634,29 @@ ha_myisammrg::check_if_supported_inplace_alter(TABLE *altered_table,
}
}
bool
ha_myisammrg
::
inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
char
tmp_path
[
FN_REFLEN
];
char
*
name
=
table
->
s
->
normalized_path
.
str
;
DBUG_ENTER
(
"ha_myisammrg::inplace_alter_table"
);
fn_format
(
tmp_path
,
name
,
""
,
MYRG_NAME_TMPEXT
,
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
);
int
res
=
create_mrg
(
tmp_path
,
ha_alter_info
->
create_info
);
if
(
res
)
mysql_file_delete
(
rg_key_file_MRG
,
tmp_path
,
MYF
(
0
));
else
{
char
path
[
FN_REFLEN
];
fn_format
(
path
,
name
,
""
,
MYRG_NAME_EXT
,
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
);
if
(
mysql_file_rename
(
rg_key_file_MRG
,
tmp_path
,
path
,
MYF
(
0
)))
{
res
=
my_errno
;
mysql_file_delete
(
rg_key_file_MRG
,
tmp_path
,
MYF
(
0
));
}
}
DBUG_RETURN
(
res
);
}
int
ha_myisammrg
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
ha_myisammrg
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
return
this
->
file
->
children_attached
?
HA_ADMIN_OK
:
HA_ADMIN_CORRUPT
;
return
this
->
file
->
children_attached
?
HA_ADMIN_OK
:
HA_ADMIN_CORRUPT
;
...
...
storage/myisammrg/ha_myisammrg.h
View file @
7f5d138a
...
@@ -138,6 +138,7 @@ public:
...
@@ -138,6 +138,7 @@ public:
int
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
);
int
extra_opt
(
enum
ha_extra_function
operation
,
ulong
cache_size
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
uint
lock_count
(
void
)
const
;
uint
lock_count
(
void
)
const
;
int
create_mrg
(
const
char
*
name
,
HA_CREATE_INFO
*
create_info
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
enum
thr_lock_type
lock_type
);
...
@@ -147,6 +148,8 @@ public:
...
@@ -147,6 +148,8 @@ public:
TABLE
*
table_ptr
()
{
return
table
;
}
TABLE
*
table_ptr
()
{
return
table
;
}
enum_alter_inplace_result
check_if_supported_inplace_alter
(
TABLE
*
,
enum_alter_inplace_result
check_if_supported_inplace_alter
(
TABLE
*
,
Alter_inplace_info
*
);
Alter_inplace_info
*
);
bool
inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
);
int
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
ha_rows
records
();
ha_rows
records
();
virtual
uint
count_query_cache_dependant_tables
(
uint8
*
tables_type
);
virtual
uint
count_query_cache_dependant_tables
(
uint8
*
tables_type
);
...
...
storage/myisammrg/myrg_create.c
View file @
7f5d138a
...
@@ -33,9 +33,7 @@ int myrg_create(const char *name, const char **table_names,
...
@@ -33,9 +33,7 @@ int myrg_create(const char *name, const char **table_names,
DBUG_ENTER
(
"myrg_create"
);
DBUG_ENTER
(
"myrg_create"
);
errpos
=
0
;
errpos
=
0
;
if
((
file
=
mysql_file_create
(
rg_key_file_MRG
,
if
((
file
=
mysql_file_create
(
rg_key_file_MRG
,
name
,
0
,
fn_format
(
buff
,
name
,
""
,
MYRG_NAME_EXT
,
MY_UNPACK_FILENAME
|
MY_APPEND_EXT
),
0
,
O_RDWR
|
O_EXCL
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
)
O_RDWR
|
O_EXCL
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
)
goto
err
;
goto
err
;
errpos
=
1
;
errpos
=
1
;
...
...
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