summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-09-03 16:02:03 +0530
committerSatya B <satya.bn@sun.com>2009-09-03 16:02:03 +0530
commit2fc9c5d19993f4af526b97153ee7363ac108831b (patch)
treebc7f9709d4619c3b3db77c9ad3c177844a34ce4b /sql/sql_table.cc
parent183607b8c864684a67fea2c11fa2755abd11f6ab (diff)
downloadmariadb-git-2fc9c5d19993f4af526b97153ee7363ac108831b.tar.gz
Fix for BUG#46591 - .frm file isn't sync'd with sync_frm enabled for
CREATE TABLE...LIKE... The mysql server option 'sync_frm' is ignored when table is created with syntax CREATE TABLE .. LIKE.. Fixed by adding the MY_SYNC flag and calling my_sync() from my_copy() when the flag is set. In mysql_create_table(), when the 'sync_frm' is set, MY_SYNC flag is passed to my_copy(). Note: TestCase is not attached and can be tested manually using debugger. client/Makefile.am: BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... add my_sync to sources as it is used in my_copy() method include/my_sys.h: BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... MY_SYNC flag is added to call my_sync() method mysys/my_copy.c: BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... my_sync() is method is called when MY_SYNC is set in my_copy() sql/sql_table.cc: BUG#46591 - .frm file isn't sync'd with sync_frm enabled for CREATE TABLE...LIKE... Fixed mysql_create_like_table() to call my_sync() when opt_sync_frm variable is set
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 84370873054..5a3100685e0 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2773,6 +2773,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table,
int err;
bool res= TRUE;
db_type not_used;
+ myf flags= MY_DONT_OVERWRITE_FILE;
DBUG_ENTER("mysql_create_like_table");
/*
@@ -2859,10 +2860,14 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table,
DBUG_EXECUTE_IF("sleep_create_like_before_copy", my_sleep(6000000););
+ if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ flags|= MY_SYNC;
+
/*
Create a new table by copying from source table
+ and sync the new table if the flag MY_SYNC is set
*/
- if (my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE)))
+ if (my_copy(src_path, dst_path, flags))
{
if (my_errno == ENOENT)
my_error(ER_BAD_DB_ERROR,MYF(0),db);