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
7c5d066b
Commit
7c5d066b
authored
Nov 05, 2008
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
50baafeb
b72d1507
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
51 deletions
+221
-51
mysql-test/r/partition_innodb_stmt.result
mysql-test/r/partition_innodb_stmt.result
+48
-0
mysql-test/t/partition_innodb_stmt.test
mysql-test/t/partition_innodb_stmt.test
+59
-0
sql/ha_partition.cc
sql/ha_partition.cc
+65
-45
sql/ha_partition.h
sql/ha_partition.h
+45
-5
sql/handler.cc
sql/handler.cc
+1
-1
sql/handler.h
sql/handler.h
+3
-0
No files found.
mysql-test/r/partition_innodb_stmt.result
0 → 100644
View file @
7c5d066b
# connection default
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
CREATE TABLE t1
(
id SMALLINT NOT NULL,
PRIMARY KEY (id)
) ENGINE=innodb
PARTITION BY RANGE (id)
(
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (4),
PARTITION p3 VALUES LESS THAN (10)
);
INSERT INTO t1 VALUES (1),(2),(3);
# Test READ COMMITTED -> REPEATABLE READ
FLUSH TABLES;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t1;
id
1
2
3
#connection con1
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t1 VALUES(7);
COMMIT;
# connection default
COMMIT;
FLUSH TABLES;
# Test REPEATABLE READ -> READ COMMITTED
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t1;
id
1
2
3
7
# connection con1
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t1 VALUES(9);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
COMMIT;
COMMIT;
DROP TABLE t1;
mysql-test/t/partition_innodb_stmt.test
0 → 100644
View file @
7c5d066b
--
source
include
/
have_binlog_format_statement
.
inc
--
source
include
/
have_innodb
.
inc
--
echo
# connection default
SET
SESSION
TRANSACTION
ISOLATION
LEVEL
REPEATABLE
READ
;
CREATE
TABLE
t1
(
id
SMALLINT
NOT
NULL
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
innodb
PARTITION
BY
RANGE
(
id
)
(
PARTITION
p1
VALUES
LESS
THAN
(
2
),
PARTITION
p2
VALUES
LESS
THAN
(
4
),
PARTITION
p3
VALUES
LESS
THAN
(
10
)
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
--
echo
# Test READ COMMITTED -> REPEATABLE READ
FLUSH
TABLES
;
SET
TRANSACTION
ISOLATION
LEVEL
READ
COMMITTED
;
BEGIN
;
SELECT
*
FROM
t1
;
connect
(
con1
,
localhost
,
root
,,);
connection
con1
;
--
echo
#connection con1
SET
TRANSACTION
ISOLATION
LEVEL
REPEATABLE
READ
;
BEGIN
;
INSERT
INTO
t1
VALUES
(
7
);
COMMIT
;
connection
default
;
--
echo
# connection default
COMMIT
;
FLUSH
TABLES
;
--
echo
# Test REPEATABLE READ -> READ COMMITTED
SET
TRANSACTION
ISOLATION
LEVEL
REPEATABLE
READ
;
BEGIN
;
SELECT
*
FROM
t1
;
connection
con1
;
--
echo
# connection con1
SET
TRANSACTION
ISOLATION
LEVEL
READ
COMMITTED
;
BEGIN
;
--
error
ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT
INTO
t1
VALUES
(
9
);
COMMIT
;
disconnect
con1
;
connection
default
;
COMMIT
;
DROP
TABLE
t1
;
sql/ha_partition.cc
View file @
7c5d066b
This diff is collapsed.
Click to expand it.
sql/ha_partition.h
View file @
7c5d066b
...
...
@@ -48,6 +48,13 @@ typedef struct st_ha_data_partition
}
HA_DATA_PARTITION
;
#define PARTITION_BYTES_IN_POS 2
#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | HA_REC_NOT_IN_SEQ)
#define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \
HA_CAN_FULLTEXT | \
HA_DUPLICATE_POS | \
HA_CAN_SQL_HANDLER | \
HA_CAN_INSERT_DELAYED | \
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION)
class
ha_partition
:
public
handler
{
private:
...
...
@@ -92,8 +99,15 @@ private:
for this since the MySQL Server sometimes allocating the handler object
without freeing them.
*/
longlong
m_table_flags
;
ulong
m_low_byte_first
;
enum
enum_handler_status
{
handler_not_initialized
=
0
,
handler_initialized
,
handler_opened
,
handler_closed
};
enum_handler_status
m_handler_status
;
uint
m_reorged_parts
;
// Number of reorganised parts
uint
m_tot_parts
;
// Total number of partitions;
...
...
@@ -189,7 +203,7 @@ public:
enable later calls of the methods to retrieve constants from the under-
lying handlers. Returns false if not successful.
*/
bool
initiali
s
e_partition
(
MEM_ROOT
*
mem_root
);
bool
initiali
z
e_partition
(
MEM_ROOT
*
mem_root
);
/*
-------------------------------------------------------------------------
...
...
@@ -594,6 +608,8 @@ public:
The partition handler will support whatever the underlying handlers
support except when specifically mentioned below about exceptions
to this rule.
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
LEVEL which is dynamic, see bug#39084.
HA_READ_RND_SAME:
Not currently used. (Means that the handler supports the rnd_same() call)
...
...
@@ -718,9 +734,33 @@ public:
transfer those calls into index_read and other calls in the
index scan module.
(NDB)
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION:
Does the storage engine need a PK for position?
Used with hidden primary key in InnoDB.
Hidden primary keys cannot be supported by partitioning, since the
partitioning expressions columns must be a part of the primary key.
(InnoDB)
HA_FILE_BASED is always set for partition handler since we use a
special file for handling names of partitions, engine types.
HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot
guarantee that the records will be returned in sequence.
HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, HA_DUPLICATE_POS,
HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled
until further investigated.
*/
virtual
ulonglong
table_flags
()
const
{
return
m_table_flags
;
}
virtual
Table_flags
table_flags
()
const
{
DBUG_ENTER
(
"ha_partition::table_flags"
);
if
(
m_handler_status
<
handler_initialized
||
m_handler_status
>=
handler_closed
)
DBUG_RETURN
(
PARTITION_ENABLED_TABLE_FLAGS
);
else
DBUG_RETURN
((
m_file
[
0
]
->
ha_table_flags
()
&
~
(
PARTITION_DISABLED_TABLE_FLAGS
))
|
(
PARTITION_ENABLED_TABLE_FLAGS
));
}
/*
This is a bitmap of flags that says how the storage engine
...
...
@@ -903,7 +943,7 @@ public:
/*
-------------------------------------------------------------------------
MODULE initiali
s
e handler for HANDLER call
MODULE initiali
z
e handler for HANDLER call
-------------------------------------------------------------------------
This method is a special InnoDB method called before a HANDLER query.
-------------------------------------------------------------------------
...
...
sql/handler.cc
View file @
7c5d066b
...
...
@@ -263,7 +263,7 @@ handler *get_ha_partition(partition_info *part_info)
DBUG_ENTER
(
"get_ha_partition"
);
if
((
partition
=
new
ha_partition
(
partition_hton
,
part_info
)))
{
if
(
partition
->
initiali
s
e_partition
(
current_thd
->
mem_root
))
if
(
partition
->
initiali
z
e_partition
(
current_thd
->
mem_root
))
{
delete
partition
;
partition
=
0
;
...
...
sql/handler.h
View file @
7c5d066b
...
...
@@ -1198,6 +1198,9 @@ public:
{
return
inited
==
INDEX
?
ha_index_end
()
:
inited
==
RND
?
ha_rnd_end
()
:
0
;
}
/**
The cached_table_flags is set at ha_open and ha_external_lock
*/
Table_flags
ha_table_flags
()
const
{
return
cached_table_flags
;
}
/**
These functions represent the public interface to *users* of the
...
...
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