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
bcf70ef6
Commit
bcf70ef6
authored
Mar 24, 2009
by
Leonard Zhou
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
56184684
40138ba7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
33 deletions
+34
-33
storage/csv/ha_tina.cc
storage/csv/ha_tina.cc
+16
-15
storage/csv/ha_tina.h
storage/csv/ha_tina.h
+7
-7
storage/csv/transparent_file.cc
storage/csv/transparent_file.cc
+6
-6
storage/csv/transparent_file.h
storage/csv/transparent_file.h
+5
-5
No files found.
storage/csv/ha_tina.cc
View file @
bcf70ef6
...
@@ -397,12 +397,12 @@ static int free_share(TINA_SHARE *share)
...
@@ -397,12 +397,12 @@ static int free_share(TINA_SHARE *share)
'\r''\n' -- DOS\Windows line ending
'\r''\n' -- DOS\Windows line ending
*/
*/
off_t
find_eoln_buff
(
Transparent_file
*
data_buff
,
off_t
begin
,
my_off_t
find_eoln_buff
(
Transparent_file
*
data_buff
,
my_
off_t
begin
,
off_t
end
,
int
*
eoln_len
)
my_
off_t
end
,
int
*
eoln_len
)
{
{
*
eoln_len
=
0
;
*
eoln_len
=
0
;
for
(
off_t
x
=
begin
;
x
<
end
;
x
++
)
for
(
my_
off_t
x
=
begin
;
x
<
end
;
x
++
)
{
{
/* Unix (includes Mac OS X) */
/* Unix (includes Mac OS X) */
if
(
data_buff
->
get_value
(
x
)
==
'\n'
)
if
(
data_buff
->
get_value
(
x
)
==
'\n'
)
...
@@ -586,7 +586,7 @@ int ha_tina::chain_append()
...
@@ -586,7 +586,7 @@ int ha_tina::chain_append()
*/
*/
int
ha_tina
::
find_current_row
(
uchar
*
buf
)
int
ha_tina
::
find_current_row
(
uchar
*
buf
)
{
{
off_t
end_offset
,
curr_offset
=
current_position
;
my_
off_t
end_offset
,
curr_offset
=
current_position
;
int
eoln_len
;
int
eoln_len
;
my_bitmap_map
*
org_bitmap
;
my_bitmap_map
*
org_bitmap
;
int
error
;
int
error
;
...
@@ -836,7 +836,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
...
@@ -836,7 +836,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
during locking. This is needed to enable concurrent inserts.
during locking. This is needed to enable concurrent inserts.
*/
*/
thr_lock_data_init
(
&
share
->
lock
,
&
lock
,
(
void
*
)
this
);
thr_lock_data_init
(
&
share
->
lock
,
&
lock
,
(
void
*
)
this
);
ref_length
=
sizeof
(
off_t
);
ref_length
=
sizeof
(
my_
off_t
);
share
->
lock
.
get_status
=
tina_get_status
;
share
->
lock
.
get_status
=
tina_get_status
;
share
->
lock
.
update_status
=
tina_update_status
;
share
->
lock
.
update_status
=
tina_update_status
;
...
@@ -1140,7 +1140,7 @@ int ha_tina::rnd_pos(uchar * buf, uchar *pos)
...
@@ -1140,7 +1140,7 @@ int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
{
DBUG_ENTER
(
"ha_tina::rnd_pos"
);
DBUG_ENTER
(
"ha_tina::rnd_pos"
);
ha_statistic_increment
(
&
SSV
::
ha_read_rnd_count
);
ha_statistic_increment
(
&
SSV
::
ha_read_rnd_count
);
current_position
=
(
off_t
)
my_get_ptr
(
pos
,
ref_length
);
current_position
=
my_get_ptr
(
pos
,
ref_length
);
DBUG_RETURN
(
find_current_row
(
buf
));
DBUG_RETURN
(
find_current_row
(
buf
));
}
}
...
@@ -1180,7 +1180,7 @@ int ha_tina::extra(enum ha_extra_function operation)
...
@@ -1180,7 +1180,7 @@ int ha_tina::extra(enum ha_extra_function operation)
to the given "hole", stored in the buffer. "Valid" here means,
to the given "hole", stored in the buffer. "Valid" here means,
not listed in the chain of deleted records ("holes").
not listed in the chain of deleted records ("holes").
*/
*/
bool
ha_tina
::
get_write_pos
(
off_t
*
end_pos
,
tina_set
*
closest_hole
)
bool
ha_tina
::
get_write_pos
(
my_
off_t
*
end_pos
,
tina_set
*
closest_hole
)
{
{
if
(
closest_hole
==
chain_ptr
)
/* no more chains */
if
(
closest_hole
==
chain_ptr
)
/* no more chains */
*
end_pos
=
file_buff
->
end
();
*
end_pos
=
file_buff
->
end
();
...
@@ -1200,7 +1200,7 @@ bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole)
...
@@ -1200,7 +1200,7 @@ bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole)
int
ha_tina
::
rnd_end
()
int
ha_tina
::
rnd_end
()
{
{
char
updated_fname
[
FN_REFLEN
];
char
updated_fname
[
FN_REFLEN
];
off_t
file_buffer_start
=
0
;
my_
off_t
file_buffer_start
=
0
;
DBUG_ENTER
(
"ha_tina::rnd_end"
);
DBUG_ENTER
(
"ha_tina::rnd_end"
);
free_root
(
&
blobroot
,
MYF
(
0
));
free_root
(
&
blobroot
,
MYF
(
0
));
...
@@ -1223,17 +1223,17 @@ int ha_tina::rnd_end()
...
@@ -1223,17 +1223,17 @@ int ha_tina::rnd_end()
my_qsort
(
chain
,
(
size_t
)(
chain_ptr
-
chain
),
sizeof
(
tina_set
),
my_qsort
(
chain
,
(
size_t
)(
chain_ptr
-
chain
),
sizeof
(
tina_set
),
(
qsort_cmp
)
sort_set
);
(
qsort_cmp
)
sort_set
);
off_t
write_begin
=
0
,
write_end
;
my_
off_t
write_begin
=
0
,
write_end
;
/* create the file to write updated table if it wasn't yet created */
/* create the file to write updated table if it wasn't yet created */
if
(
open_update_temp_file_if_needed
())
if
(
open_update_temp_file_if_needed
())
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
/* write the file with updated info */
/* write the file with updated info */
while
((
file_buffer_start
!=
-
1
))
// while not end of file
while
((
file_buffer_start
!=
(
my_off_t
)
-
1
))
// while not end of file
{
{
bool
in_hole
=
get_write_pos
(
&
write_end
,
ptr
);
bool
in_hole
=
get_write_pos
(
&
write_end
,
ptr
);
off_t
write_length
=
write_end
-
write_begin
;
my_
off_t
write_length
=
write_end
-
write_begin
;
/* if there is something to write, write it */
/* if there is something to write, write it */
if
(
write_length
)
if
(
write_length
)
...
@@ -1241,14 +1241,15 @@ int ha_tina::rnd_end()
...
@@ -1241,14 +1241,15 @@ int ha_tina::rnd_end()
if
(
my_write
(
update_temp_file
,
if
(
my_write
(
update_temp_file
,
(
uchar
*
)
(
file_buff
->
ptr
()
+
(
uchar
*
)
(
file_buff
->
ptr
()
+
(
write_begin
-
file_buff
->
start
())),
(
write_begin
-
file_buff
->
start
())),
write_length
,
MYF_RW
))
(
size_t
)
write_length
,
MYF_RW
))
goto
error
;
goto
error
;
temp_file_length
+=
write_length
;
temp_file_length
+=
write_length
;
}
}
if
(
in_hole
)
if
(
in_hole
)
{
{
/* skip hole */
/* skip hole */
while
(
file_buff
->
end
()
<=
ptr
->
end
&&
file_buffer_start
!=
-
1
)
while
(
file_buff
->
end
()
<=
ptr
->
end
&&
file_buffer_start
!=
(
my_off_t
)
-
1
)
file_buffer_start
=
file_buff
->
read_next
();
file_buffer_start
=
file_buff
->
read_next
();
write_begin
=
ptr
->
end
;
write_begin
=
ptr
->
end
;
ptr
++
;
ptr
++
;
...
@@ -1348,7 +1349,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
...
@@ -1348,7 +1349,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
File
repair_file
;
File
repair_file
;
int
rc
;
int
rc
;
ha_rows
rows_repaired
=
0
;
ha_rows
rows_repaired
=
0
;
off_t
write_begin
=
0
,
write_end
;
my_
off_t
write_begin
=
0
,
write_end
;
DBUG_ENTER
(
"ha_tina::repair"
);
DBUG_ENTER
(
"ha_tina::repair"
);
/* empty file */
/* empty file */
...
@@ -1423,7 +1424,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
...
@@ -1423,7 +1424,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
write_end
=
min
(
file_buff
->
end
(),
current_position
);
write_end
=
min
(
file_buff
->
end
(),
current_position
);
if
((
write_end
-
write_begin
)
&&
if
((
write_end
-
write_begin
)
&&
(
my_write
(
repair_file
,
(
uchar
*
)
file_buff
->
ptr
(),
(
my_write
(
repair_file
,
(
uchar
*
)
file_buff
->
ptr
(),
write_end
-
write_begin
,
MYF_RW
)))
(
size_t
)
(
write_end
-
write_begin
)
,
MYF_RW
)))
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
write_begin
=
write_end
;
write_begin
=
write_end
;
...
...
storage/csv/ha_tina.h
View file @
bcf70ef6
...
@@ -40,7 +40,7 @@ typedef struct st_tina_share {
...
@@ -40,7 +40,7 @@ typedef struct st_tina_share {
inserts, updates and deletes. The var is initialized along with the
inserts, updates and deletes. The var is initialized along with the
share initialization.
share initialization.
*/
*/
off_t
saved_data_file_length
;
my_
off_t
saved_data_file_length
;
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
THR_LOCK
lock
;
THR_LOCK
lock
;
bool
update_file_opened
;
bool
update_file_opened
;
...
@@ -53,18 +53,18 @@ typedef struct st_tina_share {
...
@@ -53,18 +53,18 @@ typedef struct st_tina_share {
}
TINA_SHARE
;
}
TINA_SHARE
;
struct
tina_set
{
struct
tina_set
{
off_t
begin
;
my_
off_t
begin
;
off_t
end
;
my_
off_t
end
;
};
};
class
ha_tina
:
public
handler
class
ha_tina
:
public
handler
{
{
THR_LOCK_DATA
lock
;
/* MySQL lock */
THR_LOCK_DATA
lock
;
/* MySQL lock */
TINA_SHARE
*
share
;
/* Shared lock info */
TINA_SHARE
*
share
;
/* Shared lock info */
off_t
current_position
;
/* Current position in the file during a file scan */
my_
off_t
current_position
;
/* Current position in the file during a file scan */
off_t
next_position
;
/* Next position in the file scan */
my_
off_t
next_position
;
/* Next position in the file scan */
my_off_t
local_saved_data_file_length
;
/* save position for reads */
my_off_t
local_saved_data_file_length
;
/* save position for reads */
off_t
temp_file_length
;
my_
off_t
temp_file_length
;
uchar
byte_buffer
[
IO_SIZE
];
uchar
byte_buffer
[
IO_SIZE
];
Transparent_file
*
file_buff
;
Transparent_file
*
file_buff
;
File
data_file
;
/* File handler for readers */
File
data_file
;
/* File handler for readers */
...
@@ -85,7 +85,7 @@ class ha_tina: public handler
...
@@ -85,7 +85,7 @@ class ha_tina: public handler
MEM_ROOT
blobroot
;
MEM_ROOT
blobroot
;
private:
private:
bool
get_write_pos
(
off_t
*
end_pos
,
tina_set
*
closest_hole
);
bool
get_write_pos
(
my_
off_t
*
end_pos
,
tina_set
*
closest_hole
);
int
open_update_temp_file_if_needed
();
int
open_update_temp_file_if_needed
();
int
init_tina_writer
();
int
init_tina_writer
();
int
init_data_file
();
int
init_data_file
();
...
...
storage/csv/transparent_file.cc
View file @
bcf70ef6
...
@@ -45,17 +45,17 @@ uchar *Transparent_file::ptr()
...
@@ -45,17 +45,17 @@ uchar *Transparent_file::ptr()
return
buff
;
return
buff
;
}
}
off_t
Transparent_file
::
start
()
my_
off_t
Transparent_file
::
start
()
{
{
return
lower_bound
;
return
lower_bound
;
}
}
off_t
Transparent_file
::
end
()
my_
off_t
Transparent_file
::
end
()
{
{
return
upper_bound
;
return
upper_bound
;
}
}
off_t
Transparent_file
::
read_next
()
my_
off_t
Transparent_file
::
read_next
()
{
{
size_t
bytes_read
;
size_t
bytes_read
;
...
@@ -64,11 +64,11 @@ off_t Transparent_file::read_next()
...
@@ -64,11 +64,11 @@ off_t Transparent_file::read_next()
always points to upper_bound byte
always points to upper_bound byte
*/
*/
if
((
bytes_read
=
my_read
(
filedes
,
buff
,
buff_size
,
MYF
(
0
)))
==
MY_FILE_ERROR
)
if
((
bytes_read
=
my_read
(
filedes
,
buff
,
buff_size
,
MYF
(
0
)))
==
MY_FILE_ERROR
)
return
(
off_t
)
-
1
;
return
(
my_
off_t
)
-
1
;
/* end of file */
/* end of file */
if
(
!
bytes_read
)
if
(
!
bytes_read
)
return
(
off_t
)
-
1
;
return
(
my_
off_t
)
-
1
;
lower_bound
=
upper_bound
;
lower_bound
=
upper_bound
;
upper_bound
+=
bytes_read
;
upper_bound
+=
bytes_read
;
...
@@ -77,7 +77,7 @@ off_t Transparent_file::read_next()
...
@@ -77,7 +77,7 @@ off_t Transparent_file::read_next()
}
}
char
Transparent_file
::
get_value
(
off_t
offset
)
char
Transparent_file
::
get_value
(
my_
off_t
offset
)
{
{
size_t
bytes_read
;
size_t
bytes_read
;
...
...
storage/csv/transparent_file.h
View file @
bcf70ef6
...
@@ -23,7 +23,7 @@ class Transparent_file
...
@@ -23,7 +23,7 @@ class Transparent_file
File
filedes
;
File
filedes
;
uchar
*
buff
;
/* in-memory window to the file or mmaped area */
uchar
*
buff
;
/* in-memory window to the file or mmaped area */
/* current window sizes */
/* current window sizes */
off_t
lower_bound
;
my_
off_t
lower_bound
;
my_off_t
upper_bound
;
my_off_t
upper_bound
;
uint
buff_size
;
uint
buff_size
;
...
@@ -34,8 +34,8 @@ public:
...
@@ -34,8 +34,8 @@ public:
void
init_buff
(
File
filedes_arg
);
void
init_buff
(
File
filedes_arg
);
uchar
*
ptr
();
uchar
*
ptr
();
off_t
start
();
my_
off_t
start
();
off_t
end
();
my_
off_t
end
();
char
get_value
(
off_t
offset
);
char
get_value
(
my_
off_t
offset
);
off_t
read_next
();
my_
off_t
read_next
();
};
};
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