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
943142e1
Commit
943142e1
authored
Jul 20, 2004
by
brian@brian-akers-computer.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for archive storage engine.
parent
8ebc9682
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
sql/examples/ha_archive.cc
sql/examples/ha_archive.cc
+13
-19
No files found.
sql/examples/ha_archive.cc
View file @
943142e1
...
...
@@ -116,10 +116,14 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
pthread_mutex_lock
(
&
LOCK_mysql_create_db
);
if
(
!
archive_init
)
{
archive_init
++
;
VOID
(
pthread_mutex_init
(
&
archive_mutex
,
MY_MUTEX_INIT_FAST
));
(
void
)
hash_init
(
&
archive_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
archive_get_key
,
0
,
0
);
if
(
!
hash_init
(
&
archive_open_tables
,
system_charset_info
,
32
,
0
,
0
,
(
hash_get_key
)
archive_get_key
,
0
,
0
))
{
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
);
return
NULL
;
}
archive_init
++
;
}
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
);
}
...
...
@@ -130,11 +134,10 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
(
byte
*
)
table_name
,
length
)))
{
if
(
!
(
share
=
(
ARCHIVE_SHARE
*
)
my_multi_malloc
(
MYF
(
MY_WME
|
MY_ZEROFILL
),
if
(
!
my_multi_malloc
(
MYF
(
MY_WME
|
MY_ZEROFILL
),
&
share
,
sizeof
(
*
share
),
&
tmp_name
,
length
+
1
,
NullS
))
)
NullS
))
{
pthread_mutex_unlock
(
&
archive_mutex
);
return
NULL
;
...
...
@@ -238,11 +241,7 @@ int ha_archive::open(const char *name, int mode, uint test_if_locked)
int
ha_archive
::
close
(
void
)
{
DBUG_ENTER
(
"ha_archive::close"
);
int
rc
=
0
;
if
(
gzclose
(
archive
)
==
Z_ERRNO
)
rc
=-
1
;
rc
|=
free_share
(
share
);
DBUG_RETURN
(
rc
);
DBUG_RETURN
(((
gzclose
(
archive
)
==
Z_ERRNO
||
free_share
(
share
))
?
-
1
:
0
));
}
...
...
@@ -276,12 +275,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *creat
}
version
=
ARCHIVE_VERSION
;
written
=
gzwrite
(
archive
,
&
version
,
sizeof
(
version
));
if
(
written
==
0
||
written
!=
sizeof
(
version
))
{
delete_table
(
name
);
DBUG_RETURN
(
-
1
);
}
if
(
gzclose
(
archive
))
if
(
written
!=
sizeof
(
version
)
||
gzclose
(
archive
))
{
delete_table
(
name
);
DBUG_RETURN
(
-
1
);
...
...
@@ -305,7 +299,7 @@ int ha_archive::write_row(byte * buf)
update_timestamp
(
buf
+
table
->
timestamp_default_now
-
1
);
written
=
gzwrite
(
share
->
archive_write
,
buf
,
table
->
reclength
);
share
->
dirty
=
true
;
if
(
written
==
0
||
written
!=
table
->
reclength
)
if
(
written
!=
table
->
reclength
)
DBUG_RETURN
(
-
1
);
for
(
Field_blob
**
field
=
table
->
blob_field
;
*
field
;
field
++
)
...
...
@@ -315,7 +309,7 @@ int ha_archive::write_row(byte * buf)
(
*
field
)
->
get_ptr
(
&
ptr
);
written
=
gzwrite
(
share
->
archive_write
,
ptr
,
(
unsigned
)
size
);
if
(
written
==
0
||
written
!=
size
)
if
(
written
!=
size
)
DBUG_RETURN
(
-
1
);
}
...
...
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