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
dbbcaf4c
Commit
dbbcaf4c
authored
Mar 24, 2009
by
Leonard Zhou
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
28f0e8cf
ae3f8c7e
Changes
4
Hide 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 @
dbbcaf4c
...
...
@@ -397,12 +397,12 @@ static int free_share(TINA_SHARE *share)
'\r''\n' -- DOS\Windows line ending
*/
off_t
find_eoln_buff
(
Transparent_file
*
data_buff
,
off_t
begin
,
off_t
end
,
int
*
eoln_len
)
my_off_t
find_eoln_buff
(
Transparent_file
*
data_buff
,
my_
off_t
begin
,
my_
off_t
end
,
int
*
eoln_len
)
{
*
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) */
if
(
data_buff
->
get_value
(
x
)
==
'\n'
)
...
...
@@ -586,7 +586,7 @@ int ha_tina::chain_append()
*/
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
;
my_bitmap_map
*
org_bitmap
;
int
error
;
...
...
@@ -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.
*/
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
.
update_status
=
tina_update_status
;
...
...
@@ -1140,7 +1140,7 @@ int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER
(
"ha_tina::rnd_pos"
);
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
));
}
...
...
@@ -1180,7 +1180,7 @@ int ha_tina::extra(enum ha_extra_function operation)
to the given "hole", stored in the buffer. "Valid" here means,
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 */
*
end_pos
=
file_buff
->
end
();
...
...
@@ -1200,7 +1200,7 @@ bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole)
int
ha_tina
::
rnd_end
()
{
char
updated_fname
[
FN_REFLEN
];
off_t
file_buffer_start
=
0
;
my_
off_t
file_buffer_start
=
0
;
DBUG_ENTER
(
"ha_tina::rnd_end"
);
free_root
(
&
blobroot
,
MYF
(
0
));
...
...
@@ -1223,17 +1223,17 @@ int ha_tina::rnd_end()
my_qsort
(
chain
,
(
size_t
)(
chain_ptr
-
chain
),
sizeof
(
tina_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 */
if
(
open_update_temp_file_if_needed
())
DBUG_RETURN
(
-
1
);
/* 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
);
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
(
write_length
)
...
...
@@ -1241,14 +1241,15 @@ int ha_tina::rnd_end()
if
(
my_write
(
update_temp_file
,
(
uchar
*
)
(
file_buff
->
ptr
()
+
(
write_begin
-
file_buff
->
start
())),
write_length
,
MYF_RW
))
(
size_t
)
write_length
,
MYF_RW
))
goto
error
;
temp_file_length
+=
write_length
;
}
if
(
in_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
();
write_begin
=
ptr
->
end
;
ptr
++
;
...
...
@@ -1348,7 +1349,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
File
repair_file
;
int
rc
;
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"
);
/* empty file */
...
...
@@ -1423,7 +1424,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
write_end
=
min
(
file_buff
->
end
(),
current_position
);
if
((
write_end
-
write_begin
)
&&
(
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
);
write_begin
=
write_end
;
...
...
storage/csv/ha_tina.h
View file @
dbbcaf4c
...
...
@@ -40,7 +40,7 @@ typedef struct st_tina_share {
inserts, updates and deletes. The var is initialized along with the
share initialization.
*/
off_t
saved_data_file_length
;
my_
off_t
saved_data_file_length
;
pthread_mutex_t
mutex
;
THR_LOCK
lock
;
bool
update_file_opened
;
...
...
@@ -53,18 +53,18 @@ typedef struct st_tina_share {
}
TINA_SHARE
;
struct
tina_set
{
off_t
begin
;
off_t
end
;
my_
off_t
begin
;
my_
off_t
end
;
};
class
ha_tina
:
public
handler
{
THR_LOCK_DATA
lock
;
/* MySQL lock */
TINA_SHARE
*
share
;
/* Shared lock info */
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
current_position
;
/* Current position in the file during a 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 */
off_t
temp_file_length
;
my_
off_t
temp_file_length
;
uchar
byte_buffer
[
IO_SIZE
];
Transparent_file
*
file_buff
;
File
data_file
;
/* File handler for readers */
...
...
@@ -85,7 +85,7 @@ class ha_tina: public handler
MEM_ROOT
blobroot
;
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
init_tina_writer
();
int
init_data_file
();
...
...
storage/csv/transparent_file.cc
View file @
dbbcaf4c
...
...
@@ -45,17 +45,17 @@ uchar *Transparent_file::ptr()
return
buff
;
}
off_t
Transparent_file
::
start
()
my_
off_t
Transparent_file
::
start
()
{
return
lower_bound
;
}
off_t
Transparent_file
::
end
()
my_
off_t
Transparent_file
::
end
()
{
return
upper_bound
;
}
off_t
Transparent_file
::
read_next
()
my_
off_t
Transparent_file
::
read_next
()
{
size_t
bytes_read
;
...
...
@@ -64,11 +64,11 @@ off_t Transparent_file::read_next()
always points to upper_bound byte
*/
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 */
if
(
!
bytes_read
)
return
(
off_t
)
-
1
;
return
(
my_
off_t
)
-
1
;
lower_bound
=
upper_bound
;
upper_bound
+=
bytes_read
;
...
...
@@ -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
;
...
...
storage/csv/transparent_file.h
View file @
dbbcaf4c
...
...
@@ -23,7 +23,7 @@ class Transparent_file
File
filedes
;
uchar
*
buff
;
/* in-memory window to the file or mmaped area */
/* current window sizes */
off_t
lower_bound
;
my_
off_t
lower_bound
;
my_off_t
upper_bound
;
uint
buff_size
;
...
...
@@ -34,8 +34,8 @@ public:
void
init_buff
(
File
filedes_arg
);
uchar
*
ptr
();
off_t
start
();
off_t
end
();
char
get_value
(
off_t
offset
);
off_t
read_next
();
my_
off_t
start
();
my_
off_t
end
();
char
get_value
(
my_
off_t
offset
);
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