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
605f3ab5
Commit
605f3ab5
authored
Jan 11, 2006
by
brian@zim.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into zim.(none):/home/brian/mysql/archive-5.1
parents
b9de3d7f
bee896be
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
35 deletions
+157
-35
mysql-test/r/archive.result
mysql-test/r/archive.result
+71
-16
mysql-test/t/archive.test
mysql-test/t/archive.test
+44
-16
sql/ha_archive.cc
sql/ha_archive.cc
+37
-3
sql/ha_archive.h
sql/ha_archive.h
+5
-0
No files found.
mysql-test/r/archive.result
View file @
605f3ab5
...
@@ -12351,18 +12351,18 @@ CREATE TABLE `t5` (
...
@@ -12351,18 +12351,18 @@ CREATE TABLE `t5` (
b char(12),
b char(12),
PRIMARY KEY (`a`)
PRIMARY KEY (`a`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (32, "foo");
INSERT INTO t5 VALUES (32, "foo");
INSERT INTO t5 VALUES (23, "foo");
INSERT INTO t5 VALUES (23, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (3, "foo");
INSERT INTO t5 VALUES (3, "foo");
ERROR 23000: Can't write; duplicate key in table 't5'
ERROR 23000: Can't write; duplicate key in table 't5'
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
SELECT * FROM t5;
SELECT * FROM t5;
a b
a b
1 foo
1 foo
...
@@ -12375,23 +12375,78 @@ a b
...
@@ -12375,23 +12375,78 @@ a b
33 foo
33 foo
34 foo
34 foo
35 foo
35 foo
SELECT * FROM t5 WHERE a=3;
a b
3 foo
DROP TABLE t5;
CREATE TABLE `t5` (
`a` int(11) NOT NULL auto_increment,
b char(12),
KEY (`a`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (32, "foo");
INSERT INTO t5 VALUES (23, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
INSERT INTO t5 VALUES (3, "foo");
INSERT INTO t5 VALUES (NULL, "foo");
SELECT * FROM t5;
a b
5 foo
6 foo
7 foo
8 foo
9 foo
32 foo
23 foo
33 foo
34 foo
3 foo
35 foo
OPTIMIZE TABLE t5;
Table Op Msg_type Msg_text
test.t5 optimize status OK
SELECT * FROM t5;
a b
5 foo
6 foo
7 foo
8 foo
9 foo
32 foo
23 foo
33 foo
34 foo
3 foo
35 foo
SELECT * FROM t5 WHERE a=32;
a b
32 foo
SELECT * FROM t5 WHERE a=3;
a b
3 foo
DROP TABLE t5;
DROP TABLE t5;
CREATE TABLE `t5` (
CREATE TABLE `t5` (
`a` int(11) NOT NULL auto_increment,
`a` int(11) NOT NULL auto_increment,
b char(12),
b char(12),
KEY (`a`)
KEY (`a`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (32, "foo");
INSERT INTO t5 VALUES (32, "foo");
INSERT INTO t5 VALUES (23, "foo");
INSERT INTO t5 VALUES (23, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
INSERT INTO t5 VALUES (3, "foo");
INSERT INTO t5 VALUES (3, "foo");
INSERT INTO t5 VALUES (
0
, "foo");
INSERT INTO t5 VALUES (
NULL
, "foo");
SELECT * FROM t5;
SELECT * FROM t5;
a b
a b
1 foo
1 foo
...
...
mysql-test/t/archive.test
View file @
605f3ab5
...
@@ -1363,20 +1363,48 @@ b char(12),
...
@@ -1363,20 +1363,48 @@ b char(12),
PRIMARY
KEY
(
`a`
)
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
ARCHIVE
DEFAULT
CHARSET
=
latin1
;
)
ENGINE
=
ARCHIVE
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
32
,
"foo"
);
INSERT
INTO
t5
VALUES
(
32
,
"foo"
);
INSERT
INTO
t5
VALUES
(
23
,
"foo"
);
INSERT
INTO
t5
VALUES
(
23
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
--
error
1022
--
error
1022
INSERT
INTO
t5
VALUES
(
3
,
"foo"
);
INSERT
INTO
t5
VALUES
(
3
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
SELECT
*
FROM
t5
;
SELECT
*
FROM
t5
;
SELECT
*
FROM
t5
WHERE
a
=
3
;
DROP
TABLE
t5
;
CREATE
TABLE
`t5`
(
`a`
int
(
11
)
NOT
NULL
auto_increment
,
b
char
(
12
),
KEY
(
`a`
)
)
ENGINE
=
ARCHIVE
DEFAULT
CHARSET
=
latin1
AUTO_INCREMENT
=
5
;
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
32
,
"foo"
);
INSERT
INTO
t5
VALUES
(
23
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
3
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
SELECT
*
FROM
t5
;
OPTIMIZE
TABLE
t5
;
SELECT
*
FROM
t5
;
SELECT
*
FROM
t5
WHERE
a
=
32
;
SELECT
*
FROM
t5
WHERE
a
=
3
;
DROP
TABLE
t5
;
DROP
TABLE
t5
;
CREATE
TABLE
`t5`
(
CREATE
TABLE
`t5`
(
...
@@ -1385,17 +1413,17 @@ b char(12),
...
@@ -1385,17 +1413,17 @@ b char(12),
KEY
(
`a`
)
KEY
(
`a`
)
)
ENGINE
=
ARCHIVE
DEFAULT
CHARSET
=
latin1
;
)
ENGINE
=
ARCHIVE
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
32
,
"foo"
);
INSERT
INTO
t5
VALUES
(
32
,
"foo"
);
INSERT
INTO
t5
VALUES
(
23
,
"foo"
);
INSERT
INTO
t5
VALUES
(
23
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
INSERT
INTO
t5
VALUES
(
3
,
"foo"
);
INSERT
INTO
t5
VALUES
(
3
,
"foo"
);
INSERT
INTO
t5
VALUES
(
0
,
"foo"
);
INSERT
INTO
t5
VALUES
(
NULL
,
"foo"
);
SELECT
*
FROM
t5
;
SELECT
*
FROM
t5
;
#
#
...
...
sql/ha_archive.cc
View file @
605f3ab5
...
@@ -581,6 +581,10 @@ int ha_archive::create(const char *name, TABLE *table_arg,
...
@@ -581,6 +581,10 @@ int ha_archive::create(const char *name, TABLE *table_arg,
int
error
;
int
error
;
DBUG_ENTER
(
"ha_archive::create"
);
DBUG_ENTER
(
"ha_archive::create"
);
auto_increment_value
=
(
create_info
->
auto_increment_value
?
create_info
->
auto_increment_value
-
1
:
(
ulonglong
)
0
);
if
((
create_file
=
my_create
(
fn_format
(
name_buff
,
name
,
""
,
ARM
,
if
((
create_file
=
my_create
(
fn_format
(
name_buff
,
name
,
""
,
ARM
,
MY_REPLACE_EXT
|
MY_UNPACK_FILENAME
),
0
,
MY_REPLACE_EXT
|
MY_UNPACK_FILENAME
),
0
,
O_RDWR
|
O_TRUNC
,
MYF
(
MY_WME
)))
<
0
)
O_RDWR
|
O_TRUNC
,
MYF
(
MY_WME
)))
<
0
)
...
@@ -607,7 +611,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
...
@@ -607,7 +611,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
}
}
}
}
write_meta_file
(
create_file
,
0
,
0
,
FALSE
);
write_meta_file
(
create_file
,
0
,
auto_increment_value
,
FALSE
);
my_close
(
create_file
,
MYF
(
0
));
my_close
(
create_file
,
MYF
(
0
));
/*
/*
...
@@ -834,7 +838,9 @@ int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
...
@@ -834,7 +838,9 @@ int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
int
rc
=
0
;
int
rc
=
0
;
bool
found
=
0
;
bool
found
=
0
;
KEY
*
mkey
=
&
table
->
s
->
key_info
[
index
];
KEY
*
mkey
=
&
table
->
s
->
key_info
[
index
];
uint
k_offset
=
mkey
->
key_part
->
offset
;
current_k_offset
=
mkey
->
key_part
->
offset
;
current_key
=
key
;
current_key_len
=
key_len
;
DBUG_ENTER
(
"ha_archive::index_read_idx"
);
DBUG_ENTER
(
"ha_archive::index_read_idx"
);
...
@@ -858,7 +864,7 @@ int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
...
@@ -858,7 +864,7 @@ int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
while
(
!
(
get_row
(
&
archive
,
buf
)))
while
(
!
(
get_row
(
&
archive
,
buf
)))
{
{
if
(
!
memcmp
(
key
,
buf
+
k_offset
,
key_len
))
if
(
!
memcmp
(
current_key
,
buf
+
current_k_offset
,
current_
key_len
))
{
{
found
=
1
;
found
=
1
;
break
;
break
;
...
@@ -872,6 +878,25 @@ error:
...
@@ -872,6 +878,25 @@ error:
DBUG_RETURN
(
rc
?
rc
:
HA_ERR_END_OF_FILE
);
DBUG_RETURN
(
rc
?
rc
:
HA_ERR_END_OF_FILE
);
}
}
int
ha_archive
::
index_next
(
byte
*
buf
)
{
bool
found
=
0
;
DBUG_ENTER
(
"ha_archive::index_next"
);
while
(
!
(
get_row
(
&
archive
,
buf
)))
{
if
(
!
memcmp
(
current_key
,
buf
+
current_k_offset
,
current_key_len
))
{
found
=
1
;
break
;
}
}
DBUG_RETURN
(
found
?
0
:
HA_ERR_END_OF_FILE
);
}
/*
/*
All calls that need to scan the table start with this method. If we are told
All calls that need to scan the table start with this method. If we are told
that it is a table scan we rewind the file to the beginning, otherwise
that it is a table scan we rewind the file to the beginning, otherwise
...
@@ -1210,6 +1235,15 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd,
...
@@ -1210,6 +1235,15 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd,
return
to
;
return
to
;
}
}
void
ha_archive
::
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{
ha_archive
::
info
(
HA_STATUS_AUTO
|
HA_STATUS_CONST
);
if
(
!
(
create_info
->
used_fields
&
HA_CREATE_USED_AUTO
))
{
create_info
->
auto_increment_value
=
auto_increment_value
;
}
}
/*
/*
Hints for optimizer, see ha_tina for more information
Hints for optimizer, see ha_tina for more information
...
...
sql/ha_archive.h
View file @
605f3ab5
...
@@ -58,6 +58,9 @@ class ha_archive: public handler
...
@@ -58,6 +58,9 @@ class ha_archive: public handler
ha_rows
scan_rows
;
/* Number of rows left in scan */
ha_rows
scan_rows
;
/* Number of rows left in scan */
bool
delayed_insert
;
/* If the insert is delayed */
bool
delayed_insert
;
/* If the insert is delayed */
bool
bulk_insert
;
/* If we are performing a bulk insert */
bool
bulk_insert
;
/* If we are performing a bulk insert */
const
byte
*
current_key
;
uint
current_key_len
;
uint
current_k_offset
;
public:
public:
ha_archive
(
TABLE_SHARE
*
table_arg
);
ha_archive
(
TABLE_SHARE
*
table_arg
);
...
@@ -85,6 +88,7 @@ public:
...
@@ -85,6 +88,7 @@ public:
uint
key_len
,
enum
ha_rkey_function
find_flag
);
uint
key_len
,
enum
ha_rkey_function
find_flag
);
virtual
int
index_read_idx
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
virtual
int
index_read_idx
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
);
uint
key_len
,
enum
ha_rkey_function
find_flag
);
int
index_next
(
byte
*
buf
);
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
);
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
);
int
close
(
void
);
int
close
(
void
);
int
write_row
(
byte
*
buf
);
int
write_row
(
byte
*
buf
);
...
@@ -104,6 +108,7 @@ public:
...
@@ -104,6 +108,7 @@ public:
int
write_data_header
(
azio_stream
*
file_to_write
);
int
write_data_header
(
azio_stream
*
file_to_write
);
void
position
(
const
byte
*
record
);
void
position
(
const
byte
*
record
);
void
info
(
uint
);
void
info
(
uint
);
void
update_create_info
(
HA_CREATE_INFO
*
create_info
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
...
...
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