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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c0c524c3
Commit
c0c524c3
authored
Oct 01, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
1ca8c7b5
cddd0d68
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
9 deletions
+120
-9
mysql-test/r/partition.result
mysql-test/r/partition.result
+15
-0
mysql-test/r/partition_binlog_stmt.result
mysql-test/r/partition_binlog_stmt.result
+13
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+22
-0
mysql-test/t/partition_binlog_stmt.test
mysql-test/t/partition_binlog_stmt.test
+26
-0
sql/ha_partition.cc
sql/ha_partition.cc
+28
-7
sql/ha_partition.h
sql/ha_partition.h
+5
-2
sql/table.cc
sql/table.cc
+10
-0
sql/table.h
sql/table.h
+1
-0
No files found.
mysql-test/r/partition.result
View file @
c0c524c3
drop table if exists t1, t2;
#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
(id INT NOT NULL PRIMARY KEY,
name VARCHAR(16) NOT NULL,
year YEAR,
INDEX name (name(8))
)
PARTITION BY HASH(id) PARTITIONS 2;
INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
CREATE TABLE t2 (id INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
DROP TABLE t1, t2;
#
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
#
CREATE TABLE t1 (
...
...
mysql-test/r/partition_binlog_stmt.result
0 → 100644
View file @
c0c524c3
DROP TABLE IF EXISTS t1;
#
# Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
# partitioned MyISAM table
CREATE TABLE t1
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name TINYBLOB NOT NULL,
modified TIMESTAMP DEFAULT '0000-00-00 00:00:00',
INDEX namelocs (name(255))) ENGINE = MyISAM
PARTITION BY HASH(id) PARTITIONS 2;
LOAD DATA LOCAL INFILE 'init_file.txt'
INTO TABLE t1 (name);
DROP TABLE t1;
mysql-test/t/partition.test
View file @
c0c524c3
...
...
@@ -14,6 +14,28 @@
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
echo
#
--
echo
# Bug#57113: ha_partition::extra(ha_extra_function):
--
echo
# Assertion `m_extra_cache' failed
CREATE
TABLE
t1
(
id
INT
NOT
NULL
PRIMARY
KEY
,
name
VARCHAR
(
16
)
NOT
NULL
,
year
YEAR
,
INDEX
name
(
name
(
8
))
)
PARTITION
BY
HASH
(
id
)
PARTITIONS
2
;
INSERT
INTO
t1
VALUES
(
1
,
'FooBar'
,
'1924'
);
CREATE
TABLE
t2
(
id
INT
);
INSERT
INTO
t2
VALUES
(
1
),(
2
);
UPDATE
t1
,
t2
SET
t1
.
year
=
'1955'
WHERE
t1
.
name
=
'FooBar'
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
--
echo
#
...
...
mysql-test/t/partition_binlog_stmt.test
0 → 100644
View file @
c0c524c3
--
source
include
/
have_partition
.
inc
--
source
include
/
have_binlog_format_statement
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
echo
#
--
echo
# Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
--
echo
# partitioned MyISAM table
--
write_file
init_file
.
txt
abcd
EOF
CREATE
TABLE
t1
(
id
INT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
name
TINYBLOB
NOT
NULL
,
modified
TIMESTAMP
DEFAULT
'0000-00-00 00:00:00'
,
INDEX
namelocs
(
name
(
255
)))
ENGINE
=
MyISAM
PARTITION
BY
HASH
(
id
)
PARTITIONS
2
;
LOAD
DATA
LOCAL
INFILE
'init_file.txt'
INTO
TABLE
t1
(
name
);
--
remove_file
init_file
.
txt
DROP
TABLE
t1
;
sql/ha_partition.cc
View file @
c0c524c3
...
...
@@ -2451,6 +2451,21 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
/****************************************************************************
MODULE open/close object
****************************************************************************/
/**
A destructor for partition-specific TABLE_SHARE data.
*/
void
ha_data_partition_destroy
(
void
*
ha_data
)
{
if
(
ha_data
)
{
HA_DATA_PARTITION
*
ha_part_data
=
(
HA_DATA_PARTITION
*
)
ha_data
;
pthread_mutex_destroy
(
&
ha_part_data
->
LOCK_auto_inc
);
}
}
/*
Open handler object
...
...
@@ -2607,6 +2622,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
}
DBUG_PRINT
(
"info"
,
(
"table_share->ha_data 0x%p"
,
ha_data
));
bzero
(
ha_data
,
sizeof
(
HA_DATA_PARTITION
));
table_share
->
ha_data_destroy
=
ha_data_partition_destroy
;
VOID
(
pthread_mutex_init
(
&
ha_data
->
LOCK_auto_inc
,
MY_MUTEX_INIT_FAST
));
}
if
(
is_not_tmp_table
)
pthread_mutex_unlock
(
&
table_share
->
mutex
);
...
...
@@ -5555,7 +5572,6 @@ int ha_partition::extra(enum ha_extra_function operation)
DBUG_RETURN
(
prepare_for_rename
());
break
;
case
HA_EXTRA_PREPARE_FOR_UPDATE
:
DBUG_ASSERT
(
m_extra_cache
);
/*
Needs to be run on the first partition in the range now, and
later in late_extra_cache, when switching to a new partition to scan.
...
...
@@ -5563,6 +5579,8 @@ int ha_partition::extra(enum ha_extra_function operation)
m_extra_prepare_for_update
=
TRUE
;
if
(
m_part_spec
.
start_part
!=
NO_CURRENT_PART_ID
)
{
if
(
!
m_extra_cache
)
m_extra_cache_part_id
=
m_part_spec
.
start_part
;
DBUG_ASSERT
(
m_extra_cache_part_id
==
m_part_spec
.
start_part
);
VOID
(
m_file
[
m_part_spec
.
start_part
]
->
extra
(
HA_EXTRA_PREPARE_FOR_UPDATE
));
}
...
...
@@ -5825,19 +5843,22 @@ void ha_partition::late_extra_cache(uint partition_id)
{
handler
*
file
;
DBUG_ENTER
(
"ha_partition::late_extra_cache"
);
DBUG_PRINT
(
"info"
,
(
"extra_cache %u partid %u size %u"
,
m_extra_cache
,
DBUG_PRINT
(
"info"
,
(
"extra_cache %u prepare %u partid %u size %u"
,
m_extra_cache
,
m_extra_prepare_for_update
,
partition_id
,
m_extra_cache_size
));
if
(
!
m_extra_cache
&&
!
m_extra_prepare_for_update
)
DBUG_VOID_RETURN
;
file
=
m_file
[
partition_id
];
if
(
m_extra_cache_size
==
0
)
VOID
(
file
->
extra
(
HA_EXTRA_CACHE
));
else
VOID
(
file
->
extra_opt
(
HA_EXTRA_CACHE
,
m_extra_cache_size
));
if
(
m_extra_cache
)
{
if
(
m_extra_cache_size
==
0
)
VOID
(
file
->
extra
(
HA_EXTRA_CACHE
));
else
VOID
(
file
->
extra_opt
(
HA_EXTRA_CACHE
,
m_extra_cache_size
));
}
if
(
m_extra_prepare_for_update
)
{
DBUG_ASSERT
(
m_extra_cache
);
VOID
(
file
->
extra
(
HA_EXTRA_PREPARE_FOR_UPDATE
));
}
m_extra_cache_part_id
=
partition_id
;
...
...
sql/ha_partition.h
View file @
c0c524c3
...
...
@@ -44,6 +44,7 @@ typedef struct st_partition_share
typedef
struct
st_ha_data_partition
{
ulonglong
next_auto_inc_val
;
/**< first non reserved value */
pthread_mutex_t
LOCK_auto_inc
;
bool
auto_inc_initialized
;
}
HA_DATA_PARTITION
;
...
...
@@ -948,8 +949,9 @@ class ha_partition :public handler
DBUG_ASSERT
(
table_share
->
ha_data
&&
!
auto_increment_lock
);
if
(
table_share
->
tmp_table
==
NO_TMP_TABLE
)
{
HA_DATA_PARTITION
*
ha_data
=
(
HA_DATA_PARTITION
*
)
table_share
->
ha_data
;
auto_increment_lock
=
TRUE
;
pthread_mutex_lock
(
&
table_share
->
mutex
);
pthread_mutex_lock
(
&
ha_data
->
LOCK_auto_inc
);
}
}
virtual
void
unlock_auto_increment
()
...
...
@@ -962,7 +964,8 @@ class ha_partition :public handler
*/
if
(
auto_increment_lock
&&
!
auto_increment_safe_stmt_log_lock
)
{
pthread_mutex_unlock
(
&
table_share
->
mutex
);
HA_DATA_PARTITION
*
ha_data
=
(
HA_DATA_PARTITION
*
)
table_share
->
ha_data
;
pthread_mutex_unlock
(
&
ha_data
->
LOCK_auto_inc
);
auto_increment_lock
=
FALSE
;
}
}
...
...
sql/table.cc
View file @
c0c524c3
...
...
@@ -425,6 +425,11 @@ void free_table_share(TABLE_SHARE *share)
key_info
->
flags
=
0
;
}
}
if
(
share
->
ha_data_destroy
)
{
share
->
ha_data_destroy
(
share
->
ha_data
);
share
->
ha_data_destroy
=
NULL
;
}
/* We must copy mem_root from share because share is allocated through it */
memcpy
((
char
*
)
&
mem_root
,
(
char
*
)
&
share
->
mem_root
,
sizeof
(
mem_root
));
free_root
(
&
mem_root
,
MYF
(
0
));
// Free's share
...
...
@@ -1616,6 +1621,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
delete
crypted
;
delete
handler_file
;
hash_free
(
&
share
->
name_hash
);
if
(
share
->
ha_data_destroy
)
{
share
->
ha_data_destroy
(
share
->
ha_data
);
share
->
ha_data_destroy
=
NULL
;
}
open_table_error
(
share
,
error
,
share
->
open_errno
,
errarg
);
DBUG_RETURN
(
error
);
...
...
sql/table.h
View file @
c0c524c3
...
...
@@ -463,6 +463,7 @@ typedef struct st_table_share
/** place to store storage engine specific data */
void
*
ha_data
;
void
(
*
ha_data_destroy
)(
void
*
);
/* An optional destructor for ha_data. */
/*
...
...
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