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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9088cbea
Commit
9088cbea
authored
Sep 21, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge
BitKeeper/etc/logging_ok: auto-union sql/ha_ndbcluster.cc: SCCS merged
parents
65c617af
c7deb0d6
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1274 additions
and
20 deletions
+1274
-20
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
mysql-test/r/archive.result
mysql-test/r/archive.result
+1208
-0
mysql-test/t/archive.test
mysql-test/t/archive.test
+2
-0
sql/examples/ha_archive.cc
sql/examples/ha_archive.cc
+56
-13
sql/examples/ha_archive.h
sql/examples/ha_archive.h
+1
-1
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+6
-6
No files found.
BitKeeper/etc/logging_ok
View file @
9088cbea
...
...
@@ -30,6 +30,7 @@ bk@admin.bk
bk@mysql.r18.ru
brian@avenger.(none)
brian@brian-akers-computer.local
brian@private-client-ip-101.oz.net
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
dlenev@brandersnatch.localdomain
...
...
mysql-test/r/archive.result
View file @
9088cbea
This diff is collapsed.
Click to expand it.
mysql-test/t/archive.test
View file @
9088cbea
...
...
@@ -1297,4 +1297,6 @@ INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
INSERT
INTO
t2
VALUES
(
3
,
011402
,
37
,
'Romans'
,
'scholastics'
,
'jarring'
,
''
);
INSERT
INTO
t2
VALUES
(
4
,
011403
,
37
,
'intercepted'
,
'audiology'
,
'tinily'
,
''
);
SELECT
*
FROM
t2
;
OPTIMIZE
TABLE
t2
;
SELECT
*
FROM
t2
;
drop
table
t1
,
t2
;
sql/examples/ha_archive.cc
View file @
9088cbea
...
...
@@ -70,7 +70,6 @@
Allow users to set compression level.
Add truncate table command.
Implement versioning, should be easy.
Implement optimize so we can fix broken tables.
Allow for errors, find a way to mark bad rows.
See if during an optimize you can make the table smaller.
Talk to the gzip guys, come up with a writable format so that updates are doable
...
...
@@ -88,6 +87,7 @@ static int archive_init= 0;
/* The file extension */
#define ARZ ".ARZ"
#define ARN ".ARN"
/*
Used for hash table that tracks open tables.
...
...
@@ -117,7 +117,7 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
if
(
!
archive_init
)
{
VOID
(
pthread_mutex_init
(
&
archive_mutex
,
MY_MUTEX_INIT_FAST
));
if
(
!
hash_init
(
&
archive_open_tables
,
system_charset_info
,
32
,
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
);
...
...
@@ -205,7 +205,7 @@ static int free_share(ARCHIVE_SHARE *share)
We just implement one additional file extension.
*/
const
char
**
ha_archive
::
bas_ext
()
const
{
static
const
char
*
ext
[]
=
{
ARZ
,
NullS
};
return
ext
;
}
{
static
const
char
*
ext
[]
=
{
ARZ
,
ARN
,
NullS
};
return
ext
;
}
/*
...
...
@@ -322,6 +322,11 @@ int ha_archive::create(const char *name, TABLE *table_arg,
/*
Look at ha_archive::open() for an explanation of the row format.
Here we just write out the row.
Wondering about start_bulk_insert()? We don't implement it for
archive since it optimizes for lots of writes. The only save
for implementing start_bulk_insert() is that we could skip
setting dirty to true each time.
*/
int
ha_archive
::
write_row
(
byte
*
buf
)
{
...
...
@@ -380,17 +385,7 @@ int ha_archive::rnd_init(bool scan)
pthread_mutex_lock
(
&
share
->
mutex
);
if
(
share
->
dirty
==
TRUE
)
{
/* I was having problems with OSX, but it worked for 10.3 so I am wrapping this with and ifdef */
#ifdef BROKEN_GZFLUSH
gzclose
(
share
->
archive_write
);
if
((
share
->
archive_write
=
gzopen
(
share
->
data_file_name
,
"ab"
))
==
NULL
)
{
pthread_mutex_unlock
(
&
share
->
mutex
);
DBUG_RETURN
(
errno
?
errno
:
-
1
);
}
#else
gzflush
(
share
->
archive_write
,
Z_SYNC_FLUSH
);
#endif
share
->
dirty
=
FALSE
;
}
pthread_mutex_unlock
(
&
share
->
mutex
);
...
...
@@ -504,6 +499,54 @@ int ha_archive::rnd_pos(byte * buf, byte *pos)
DBUG_RETURN
(
get_row
(
buf
));
}
/*
The table can become fragmented if data was inserted, read, and then
inserted again. What we do is open up the file and recompress it completely.
*/
int
ha_archive
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
DBUG_ENTER
(
"ha_archive::optimize"
);
int
read
;
// Bytes read, gzread() returns int
gzFile
reader
,
writer
;
char
block
[
IO_SIZE
];
char
writer_filename
[
FN_REFLEN
];
/* Lets create a file to contain the new data */
fn_format
(
writer_filename
,
share
->
table_name
,
""
,
ARN
,
MY_REPLACE_EXT
|
MY_UNPACK_FILENAME
);
/* Closing will cause all data waiting to be flushed, to be flushed */
gzclose
(
share
->
archive_write
);
if
((
reader
=
gzopen
(
share
->
data_file_name
,
"rb"
))
==
NULL
)
DBUG_RETURN
(
-
1
);
if
((
writer
=
gzopen
(
writer_filename
,
"wb"
))
==
NULL
)
{
gzclose
(
reader
);
DBUG_RETURN
(
-
1
);
}
while
(
read
=
gzread
(
reader
,
block
,
IO_SIZE
))
gzwrite
(
writer
,
block
,
read
);
gzclose
(
reader
);
gzclose
(
writer
);
my_rename
(
writer_filename
,
share
->
data_file_name
,
MYF
(
0
));
/*
We reopen the file in case some IO is waiting to go through.
In theory the table is closed right after this operation,
but it is possible for IO to still happen.
I may be being a bit too paranoid right here.
*/
if
((
share
->
archive_write
=
gzopen
(
share
->
data_file_name
,
"ab"
))
==
NULL
)
DBUG_RETURN
(
errno
?
errno
:
-
1
);
share
->
dirty
=
FALSE
;
DBUG_RETURN
(
0
);
}
/******************************************************************************
Everything below here is default, please look at ha_example.cc for
...
...
sql/examples/ha_archive.h
View file @
9088cbea
...
...
@@ -112,7 +112,7 @@ class ha_archive: public handler
int
external_lock
(
THD
*
thd
,
int
lock_type
);
ha_rows
records_in_range
(
uint
inx
,
key_range
*
min_key
,
key_range
*
max_key
);
int
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
);
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
);
};
sql/ha_ndbcluster.cc
View file @
9088cbea
...
...
@@ -666,10 +666,8 @@ int ha_ndbcluster::get_metadata(const char *path)
if
(
error
)
DBUG_RETURN
(
error
);
// All checks OK, lets use the table
// m_table= (void*)tab;
m_table
=
0
;
m_table_info
=
0
;
m_table
=
NULL
;
m_table_info
=
NULL
;
DBUG_RETURN
(
build_index_list
(
table
,
ILBP_OPEN
));
}
...
...
@@ -784,6 +782,7 @@ void ha_ndbcluster::release_metadata()
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s"
,
m_tabname
));
m_table
=
NULL
;
m_table_info
=
NULL
;
// Release index list
for
(
i
=
0
;
i
<
MAX_KEY
;
i
++
)
...
...
@@ -2836,8 +2835,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
thd
->
transaction
.
stmt
.
ndb_tid
=
0
;
}
}
m_table
=
(
void
*
)
0
;
m_table_info
=
0
;
m_table
=
NULL
;
m_table_info
=
NULL
;
if
(
m_active_trans
)
DBUG_PRINT
(
"warning"
,
(
"m_active_trans != NULL"
));
if
(
m_active_cursor
)
...
...
@@ -3337,6 +3336,7 @@ int ha_ndbcluster::alter_table_name(const char *from, const char *to)
ERR_RETURN
(
dict
->
getNdbError
());
m_table
=
NULL
;
m_table_info
=
NULL
;
DBUG_RETURN
(
0
);
}
...
...
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