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
8dd90e88
Commit
8dd90e88
authored
Apr 26, 2007
by
tomas@whalegate.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#1190 preparatory work needed for compatability with future online add column
parent
5c2138f5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
167 additions
and
0 deletions
+167
-0
mysql-test/r/ndb_partition_key.result
mysql-test/r/ndb_partition_key.result
+1
-0
mysql-test/r/ndb_row_format.result
mysql-test/r/ndb_row_format.result
+39
-0
mysql-test/t/ndb_row_format.test
mysql-test/t/ndb_row_format.test
+62
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+64
-0
storage/ndb/test/src/NDBT_Table.cpp
storage/ndb/test/src/NDBT_Table.cpp
+1
-0
No files found.
mysql-test/r/ndb_partition_key.result
View file @
8dd90e88
...
...
@@ -57,6 +57,7 @@ Number of primary keys: 3
Length of frm data: #
Row Checksum: 1
Row GCI: 1
ForceVarPart: 1
TableStatus: Retrieved
-- Attributes --
a Int PRIMARY KEY AT=FIXED ST=MEMORY
...
...
mysql-test/r/ndb_row_format.result
0 → 100644
View file @
8dd90e88
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists mysqltest;
CREATE TABLE t1
( a INT KEY,
b VARCHAR(10) )
ROW_FORMAT=FIXED
ENGINE=NDB;
ERROR HY000: Can't create table 'test.t1' (errno: 138)
SHOW WARNINGS;
Level Code Message
Error 1466 Table storage engine 'ndbcluster' does not support the create option 'Row format FIXED incompatible with variable sized attributes'
Error 1005 Can't create table 'test.t1' (errno: 138)
CREATE TABLE t1
( a INT KEY,
b INT )
ENGINE=NDB;
ForceVarPart: 1
DROP TABLE t1;
CREATE TABLE t1
( a INT KEY,
b INT )
ROW_FORMAT=DEFAULT
ENGINE=NDB;
ForceVarPart: 1
DROP TABLE t1;
CREATE TABLE t1
( a INT KEY,
b INT )
ROW_FORMAT=FIXED
ENGINE=NDB;
ForceVarPart: 0
DROP TABLE t1;
CREATE TABLE t1
( a INT KEY,
b INT )
ROW_FORMAT=DYNAMIC
ENGINE=NDB;
ForceVarPart: 1
DROP TABLE t1;
mysql-test/t/ndb_row_format.test
0 → 100644
View file @
8dd90e88
--
source
include
/
have_ndb
.
inc
--
source
include
/
not_embedded
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
;
drop
database
if
exists
mysqltest
;
--
enable_warnings
#
# some negative tests
#
# cannot have ROW_FORMAT=FIXED and var attrs mixed
--
error
1005
CREATE
TABLE
t1
(
a
INT
KEY
,
b
VARCHAR
(
10
)
)
ROW_FORMAT
=
FIXED
ENGINE
=
NDB
;
# warnings give more detail on the error
SHOW
WARNINGS
;
#
# Check force var part for different ROW_FORMAT
#
# default => ForceVarPart: 1
CREATE
TABLE
t1
(
a
INT
KEY
,
b
INT
)
ENGINE
=
NDB
;
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t1
|
grep
ForceVarPart
DROP
TABLE
t1
;
# explicit DEFAULT => ForceVarPart: 1
CREATE
TABLE
t1
(
a
INT
KEY
,
b
INT
)
ROW_FORMAT
=
DEFAULT
ENGINE
=
NDB
;
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t1
|
grep
ForceVarPart
DROP
TABLE
t1
;
# FIXED => ForceVarPart: 0
CREATE
TABLE
t1
(
a
INT
KEY
,
b
INT
)
ROW_FORMAT
=
FIXED
ENGINE
=
NDB
;
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t1
|
grep
ForceVarPart
DROP
TABLE
t1
;
# DYNAMIC => ForceVarPart: 1
CREATE
TABLE
t1
(
a
INT
KEY
,
b
INT
)
ROW_FORMAT
=
DYNAMIC
ENGINE
=
NDB
;
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t1
|
grep
ForceVarPart
DROP
TABLE
t1
;
sql/ha_ndbcluster.cc
View file @
8dd90e88
...
...
@@ -647,6 +647,26 @@ static bool ndb_supported_type(enum_field_types type)
#endif
/* !DBUG_OFF */
/*
Check if MySQL field type forces var part in ndb storage
*/
static
bool
field_type_forces_var_part
(
enum_field_types
type
)
{
switch
(
type
)
{
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_VARCHAR
:
return
TRUE
;
case
MYSQL_TYPE_TINY_BLOB
:
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_MEDIUM_BLOB
:
case
MYSQL_TYPE_LONG_BLOB
:
case
MYSQL_TYPE_GEOMETRY
:
return
FALSE
;
default:
return
FALSE
;
}
}
/*
Instruct NDB to set the value of the hidden primary key
*/
...
...
@@ -4862,6 +4882,28 @@ int ha_ndbcluster::create(const char *name,
create_info
->
storage_media
=
HA_SM_DISK
;
//if use tablespace, that also means store on disk
}
/*
Handle table row type
Default is to let table rows have var part reference so that online
add column can be performed in the future. Explicitly setting row
type to fixed will omit var part reference, which will save data
memory in ndb, but at the cost of not being able to online add
column to this table
*/
switch
(
create_info
->
row_type
)
{
case
ROW_TYPE_FIXED
:
tab
.
setForceVarPart
(
FALSE
);
break
;
case
ROW_TYPE_DYNAMIC
:
/* fall through, treat as default */
default:
/* fall through, treat as default */
case
ROW_TYPE_DEFAULT
:
tab
.
setForceVarPart
(
TRUE
);
break
;
}
/*
Setup columns
*/
...
...
@@ -4879,6 +4921,28 @@ int ha_ndbcluster::create(const char *name,
else
col
.
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeMemory
);
switch
(
create_info
->
row_type
)
{
case
ROW_TYPE_FIXED
:
if
(
field_type_forces_var_part
(
field
->
type
()))
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_ILLEGAL_HA_CREATE_OPTION
,
ER
(
ER_ILLEGAL_HA_CREATE_OPTION
),
ndbcluster_hton_name
,
"Row format FIXED incompatible with "
"variable sized attribute"
);
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
}
break
;
case
ROW_TYPE_DYNAMIC
:
/*
Future: make columns dynamic in this case
*/
break
;
default:
break
;
}
tab
.
addColumn
(
col
);
if
(
col
.
getPrimaryKey
())
pk_length
+=
(
field
->
pack_length
()
+
3
)
/
4
;
...
...
storage/ndb/test/src/NDBT_Table.cpp
View file @
8dd90e88
...
...
@@ -33,6 +33,7 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
ndbout
<<
"Length of frm data: "
<<
tab
.
getFrmLength
()
<<
endl
;
ndbout
<<
"Row Checksum: "
<<
tab
.
getRowChecksumIndicator
()
<<
endl
;
ndbout
<<
"Row GCI: "
<<
tab
.
getRowGCIIndicator
()
<<
endl
;
ndbout
<<
"ForceVarPart: "
<<
tab
.
getForceVarPart
()
<<
endl
;
//<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl;
...
...
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