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
e8d9458f
Commit
e8d9458f
authored
May 19, 2006
by
petr@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#3244 "CSV engine: convert mmap to read/write calls"
parent
593daae1
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
357 additions
and
179 deletions
+357
-179
mysql-test/r/csv.result
mysql-test/r/csv.result
+2
-2
storage/csv/ha_tina.cc
storage/csv/ha_tina.cc
+291
-172
storage/csv/ha_tina.h
storage/csv/ha_tina.h
+64
-5
No files found.
mysql-test/r/csv.result
View file @
e8d9458f
...
...
@@ -4944,10 +4944,10 @@ val
UPDATE bug13894 SET val=6 WHERE val=10;
SELECT * FROM bug13894;
val
5
11
6
6
5
11
DROP TABLE bug13894;
DROP TABLE IF EXISTS bug14672;
CREATE TABLE bug14672 (c1 integer) engine = CSV;
...
...
storage/csv/ha_tina.cc
View file @
e8d9458f
This diff is collapsed.
Click to expand it.
storage/csv/ha_tina.h
View file @
e8d9458f
...
...
@@ -19,6 +19,7 @@
#include <my_dir.h>
#define DEFAULT_CHAIN_LENGTH 512
#define DEFAULT_FILE_WINDOW_SIZE 4096
/*
Version for file format.
1 - Initial Version. That is, the version when the metafile was introduced.
...
...
@@ -29,15 +30,12 @@
typedef
struct
st_tina_share
{
char
*
table_name
;
char
data_file_name
[
FN_REFLEN
];
byte
*
mapped_file
;
/* mapped region of file */
uint
table_name_length
,
use_count
;
/*
Below flag is needed to make log tables work with concurrent insert.
For more details see comment to ha_tina::update_status.
*/
my_bool
is_log_table
;
MY_STAT
file_stat
;
/* Stat information for the data file */
File
data_file
;
/* Current open data file */
/*
Here we save the length of the file for readers. This is updated by
inserts, updates and deletes. The var is initialized along with the
...
...
@@ -46,7 +44,10 @@ typedef struct st_tina_share {
off_t
saved_data_file_length
;
pthread_mutex_t
mutex
;
THR_LOCK
lock
;
bool
update_file_opened
;
bool
tina_write_opened
;
File
meta_file
;
/* Meta file we use */
File
tina_write_filedes
;
/* File handler for readers */
bool
crashed
;
/* Meta file is crashed */
ha_rows
rows_recorded
;
/* Number of rows in tables */
}
TINA_SHARE
;
...
...
@@ -56,6 +57,54 @@ struct tina_set {
off_t
end
;
};
class
Transparent_file
{
File
filedes
;
byte
*
buff
;
/* in-memory window to the file or mmaped area */
/* current window sizes */
off_t
lower_bound
;
off_t
upper_bound
;
uint
buff_size
;
public:
Transparent_file
(
File
filedes_arg
)
:
lower_bound
(
0
),
buff_size
(
DEFAULT_FILE_WINDOW_SIZE
)
{
buff
=
(
byte
*
)
my_malloc
(
buff_size
*
sizeof
(
byte
),
MYF
(
MY_WME
));
/* read the beginning of the file */
init_buff
(
filedes_arg
);
}
~
Transparent_file
()
{
my_free
(
buff
,
MYF
(
MY_ALLOW_ZERO_PTR
));
}
void
init_buff
(
File
filedes_arg
)
{
filedes
=
filedes_arg
;
/* read the beginning of the file */
lower_bound
=
0
;
VOID
(
my_seek
(
filedes
,
0
,
MY_SEEK_SET
,
MYF
(
0
)));
if
(
filedes
&&
buff
)
upper_bound
=
my_read
(
filedes
,
buff
,
buff_size
,
MYF
(
0
));
}
byte
*
ptr
()
{
return
buff
;
}
off_t
start
()
{
return
lower_bound
;
}
off_t
end
()
{
return
upper_bound
;
}
/* get a char from the given position in the file */
char
get_value
(
off_t
offset
);
/* shift a buffer windows to see the next part of the file */
off_t
read_next
();
};
class
ha_tina
:
public
handler
{
THR_LOCK_DATA
lock
;
/* MySQL lock */
...
...
@@ -64,6 +113,9 @@ class ha_tina: public handler
off_t
next_position
;
/* Next position in the file scan */
off_t
local_saved_data_file_length
;
/* save position for reads */
byte
byte_buffer
[
IO_SIZE
];
Transparent_file
*
file_buff
;
File
data_file
;
/* File handler for readers */
File
update_temp_file
;
String
buffer
;
/*
The chain contains "holes" in the file, occured because of
...
...
@@ -77,12 +129,19 @@ class ha_tina: public handler
uint32
chain_size
;
bool
records_is_known
;
private:
bool
get_write_pos
(
off_t
*
end_pos
,
tina_set
*
closest_hole
);
int
open_update_temp_file_if_needed
();
int
init_tina_writer
();
public:
ha_tina
(
TABLE_SHARE
*
table_arg
);
~
ha_tina
()
~
ha_tina
()
{
if
(
chain_alloced
)
my_free
((
gptr
)
chain
,
0
);
my_free
((
gptr
)
chain
,
0
);
if
(
file_buff
)
delete
file_buff
;
}
const
char
*
table_type
()
const
{
return
"CSV"
;
}
const
char
*
index_type
(
uint
inx
)
{
return
"NONE"
;
}
...
...
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