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
b2ca0304
Commit
b2ca0304
authored
Apr 26, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #24667 After ALTER TABLE operation ndb_dd table becomes regular ndb
parent
6932b4d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
29 deletions
+35
-29
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+35
-29
No files found.
sql/ha_ndbcluster.cc
View file @
b2ca0304
...
@@ -4749,14 +4749,14 @@ static int create_ndb_column(NDBCOL &col,
...
@@ -4749,14 +4749,14 @@ static int create_ndb_column(NDBCOL &col,
int
ha_ndbcluster
::
create
(
const
char
*
name
,
int
ha_ndbcluster
::
create
(
const
char
*
name
,
TABLE
*
form
,
TABLE
*
form
,
HA_CREATE_INFO
*
info
)
HA_CREATE_INFO
*
create_
info
)
{
{
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
NDBTAB
tab
;
NDBTAB
tab
;
NDBCOL
col
;
NDBCOL
col
;
uint
pack_length
,
length
,
i
,
pk_length
=
0
;
uint
pack_length
,
length
,
i
,
pk_length
=
0
;
const
void
*
data
=
NULL
,
*
pack_data
=
NULL
;
const
void
*
data
=
NULL
,
*
pack_data
=
NULL
;
bool
create_from_engine
=
(
info
->
table_options
&
HA_OPTION_CREATE_FROM_ENGINE
);
bool
create_from_engine
=
(
create_
info
->
table_options
&
HA_OPTION_CREATE_FROM_ENGINE
);
bool
is_truncate
=
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
);
bool
is_truncate
=
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
);
char
tablespace
[
FN_LEN
];
char
tablespace
[
FN_LEN
];
...
@@ -4780,7 +4780,7 @@ int ha_ndbcluster::create(const char *name,
...
@@ -4780,7 +4780,7 @@ int ha_ndbcluster::create(const char *name,
if
(
!
(
m_table
=
ndbtab_g
.
get_table
()))
if
(
!
(
m_table
=
ndbtab_g
.
get_table
()))
ERR_RETURN
(
dict
->
getNdbError
());
ERR_RETURN
(
dict
->
getNdbError
());
if
((
get_tablespace_name
(
thd
,
tablespace
,
FN_LEN
)))
if
((
get_tablespace_name
(
thd
,
tablespace
,
FN_LEN
)))
info
->
tablespace
=
tablespace
;
create_
info
->
tablespace
=
tablespace
;
m_table
=
NULL
;
m_table
=
NULL
;
}
}
DBUG_PRINT
(
"info"
,
(
"Dropping and re-creating table for TRUNCATE"
));
DBUG_PRINT
(
"info"
,
(
"Dropping and re-creating table for TRUNCATE"
));
...
@@ -4821,7 +4821,7 @@ int ha_ndbcluster::create(const char *name,
...
@@ -4821,7 +4821,7 @@ int ha_ndbcluster::create(const char *name,
DBUG_PRINT
(
"table"
,
(
"name: %s"
,
m_tabname
));
DBUG_PRINT
(
"table"
,
(
"name: %s"
,
m_tabname
));
tab
.
setName
(
m_tabname
);
tab
.
setName
(
m_tabname
);
tab
.
setLogging
(
!
(
info
->
options
&
HA_LEX_CREATE_TMP_TABLE
));
tab
.
setLogging
(
!
(
create_
info
->
options
&
HA_LEX_CREATE_TMP_TABLE
));
// Save frm data for this table
// Save frm data for this table
if
(
readfrm
(
name
,
&
data
,
&
length
))
if
(
readfrm
(
name
,
&
data
,
&
length
))
...
@@ -4836,16 +4836,45 @@ int ha_ndbcluster::create(const char *name,
...
@@ -4836,16 +4836,45 @@ int ha_ndbcluster::create(const char *name,
my_free
((
char
*
)
data
,
MYF
(
0
));
my_free
((
char
*
)
data
,
MYF
(
0
));
my_free
((
char
*
)
pack_data
,
MYF
(
0
));
my_free
((
char
*
)
pack_data
,
MYF
(
0
));
/*
Check for disk options
*/
if
(
create_info
->
storage_media
==
HA_SM_DISK
)
{
if
(
create_info
->
tablespace
)
tab
.
setTablespaceName
(
create_info
->
tablespace
);
else
tab
.
setTablespaceName
(
"DEFAULT-TS"
);
}
else
if
(
create_info
->
tablespace
)
{
if
(
create_info
->
storage_media
==
HA_SM_MEMORY
)
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_ILLEGAL_HA_CREATE_OPTION
,
ER
(
ER_ILLEGAL_HA_CREATE_OPTION
),
ndbcluster_hton_name
,
"TABLESPACE currently only supported for "
"STORAGE DISK"
);
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
}
tab
.
setTablespaceName
(
create_info
->
tablespace
);
create_info
->
storage_media
=
HA_SM_DISK
;
//if use tablespace, that also means store on disk
}
/*
Setup columns
*/
for
(
i
=
0
;
i
<
form
->
s
->
fields
;
i
++
)
for
(
i
=
0
;
i
<
form
->
s
->
fields
;
i
++
)
{
{
Field
*
field
=
form
->
field
[
i
];
Field
*
field
=
form
->
field
[
i
];
DBUG_PRINT
(
"info"
,
(
"name: %s, type: %u, pack_length: %d"
,
DBUG_PRINT
(
"info"
,
(
"name: %s, type: %u, pack_length: %d"
,
field
->
field_name
,
field
->
real_type
(),
field
->
field_name
,
field
->
real_type
(),
field
->
pack_length
()));
field
->
pack_length
()));
if
((
my_errno
=
create_ndb_column
(
col
,
field
,
info
)))
if
((
my_errno
=
create_ndb_column
(
col
,
field
,
create_
info
)))
DBUG_RETURN
(
my_errno
);
DBUG_RETURN
(
my_errno
);
if
(
info
->
storage_media
==
HA_SM_DISK
)
if
(
create_
info
->
storage_media
==
HA_SM_DISK
)
col
.
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeDisk
);
col
.
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeDisk
);
else
else
col
.
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeMemory
);
col
.
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeMemory
);
...
@@ -4865,29 +4894,6 @@ int ha_ndbcluster::create(const char *name,
...
@@ -4865,29 +4894,6 @@ int ha_ndbcluster::create(const char *name,
NdbDictionary
::
Column
::
StorageTypeMemory
);
NdbDictionary
::
Column
::
StorageTypeMemory
);
}
}
if
(
info
->
storage_media
==
HA_SM_DISK
)
{
if
(
info
->
tablespace
)
tab
.
setTablespaceName
(
info
->
tablespace
);
else
tab
.
setTablespaceName
(
"DEFAULT-TS"
);
}
else
if
(
info
->
tablespace
)
{
if
(
info
->
storage_media
==
HA_SM_MEMORY
)
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_ILLEGAL_HA_CREATE_OPTION
,
ER
(
ER_ILLEGAL_HA_CREATE_OPTION
),
ndbcluster_hton_name
,
"TABLESPACE currently only supported for "
"STORAGE DISK"
);
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
}
tab
.
setTablespaceName
(
info
->
tablespace
);
info
->
storage_media
=
HA_SM_DISK
;
//if use tablespace, that also means store on disk
}
// No primary key, create shadow key as 64 bit, auto increment
// No primary key, create shadow key as 64 bit, auto increment
if
(
form
->
s
->
primary_key
==
MAX_KEY
)
if
(
form
->
s
->
primary_key
==
MAX_KEY
)
{
{
...
...
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