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
5465dd08
Commit
5465dd08
authored
Jun 10, 2008
by
Guilhem Bichot
Browse files
Options
Browse Files
Download
Plain Diff
automerge
parents
a0aa81f9
7c87c307
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
323 additions
and
153 deletions
+323
-153
storage/maria/CMakeLists.txt
storage/maria/CMakeLists.txt
+1
-1
storage/maria/ma_loghandler.c
storage/maria/ma_loghandler.c
+237
-138
storage/maria/ma_state.c
storage/maria/ma_state.c
+2
-2
storage/maria/unittest/Makefile.am
storage/maria/unittest/Makefile.am
+3
-0
storage/maria/unittest/ma_test_loghandler_multithread-t.c
storage/maria/unittest/ma_test_loghandler_multithread-t.c
+80
-12
No files found.
storage/maria/CMakeLists.txt
View file @
5465dd08
...
...
@@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
SET
(
MARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
ma_rnext.c ma_rnext_same.c
ma_search.c ma_page.c ma_key_recover.c ma_key.c
ma_locking.c
ma_locking.c
ma_state.c
ma_rrnd.c ma_scan.c ma_cache.c
ma_statrec.c ma_packrec.c ma_dynrec.c
ma_blockrec.c ma_bitmap.c
...
...
storage/maria/ma_loghandler.c
View file @
5465dd08
This diff is collapsed.
Click to expand it.
storage/maria/ma_state.c
View file @
5465dd08
...
...
@@ -28,9 +28,9 @@
10 ended transactions since last time it was called.
*/
#include
<maria_def.h>
#include
"maria_def.h"
#include "trnman.h"
#include
<ma_blockrec.h>
#include
"ma_blockrec.h"
/**
@brief Setup initial start-of-transaction state for a table
...
...
storage/maria/unittest/Makefile.am
View file @
5465dd08
...
...
@@ -42,6 +42,7 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler-t
\
ma_test_loghandler_multigroup-t
\
ma_test_loghandler_multithread-t
\
ma_test_loghandler_multiflush-t
\
ma_test_loghandler_pagecache-t
\
ma_test_loghandler_long-t
\
ma_test_loghandler_noflush-t
\
...
...
@@ -54,6 +55,8 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler_t_SOURCES
=
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multigroup_t_SOURCES
=
ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c sequence_storage.h
ma_test_loghandler_multithread_t_SOURCES
=
ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multiflush_t_SOURCES
=
ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multiflush_t_CPPFLAGS
=
-DMULTIFLUSH_TEST
ma_test_loghandler_pagecache_t_SOURCES
=
ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_long_t_SOURCES
=
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_long_t_CPPFLAGS
=
-DLONG_LOG_TEST
...
...
storage/maria/unittest/ma_test_loghandler_multithread-t.c
View file @
5465dd08
...
...
@@ -28,16 +28,35 @@ static const char *default_dbug_option;
#define PCACHE_SIZE (1024*1024*10)
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
/*#define LOG_FLAGS TRANSLOG_SECTOR_PROTECTION | TRANSLOG_PAGE_CRC */
#define LOG_FLAGS 0
/*#define LONG_BUFFER_SIZE (1024L*1024L*1024L + 1024L*1024L*512)*/
#ifdef MULTIFLUSH_TEST
#define LONG_BUFFER_SIZE (16384L)
#define MIN_REC_LENGTH 10
#define SHOW_DIVIDER 20
#define ITERATIONS 10000
#define FLUSH_ITERATIONS 1000
#define WRITERS 2
#define FLUSHERS 10
#else
#define LONG_BUFFER_SIZE (512L*1024L*1024L)
#define MIN_REC_LENGTH 30
#define SHOW_DIVIDER 10
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
#define ITERATIONS 3
#define FLUSH_ITERATIONS 0
#define WRITERS 3
#define FLUSHERS 0
#endif
static
uint
number_of_writers
=
WRITERS
;
static
uint
number_of_flushers
=
FLUSHERS
;
static
pthread_cond_t
COND_thread_count
;
static
pthread_mutex_t
LOCK_thread_count
;
...
...
@@ -48,6 +67,9 @@ static LSN lsns1[WRITERS][ITERATIONS];
static
LSN
lsns2
[
WRITERS
][
ITERATIONS
];
static
uchar
*
long_buffer
;
static
LSN
last_lsn
;
/* For test purposes the variable allow dirty read/write */
/*
Get pseudo-random length of the field in
limits [MIN_REC_LENGTH..LONG_BUFFER_SIZE]
...
...
@@ -177,6 +199,7 @@ void writer(int num)
return
;
}
lsns2
[
num
][
i
]
=
lsn
;
last_lsn
=
lsn
;
pthread_mutex_lock
(
&
LOCK_thread_count
);
ok
(
1
,
"write records"
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
...
...
@@ -205,6 +228,33 @@ static void *test_thread_writer(void *arg)
}
static
void
*
test_thread_flusher
(
void
*
arg
)
{
int
param
=
*
((
int
*
)
arg
);
int
i
;
my_thread_init
();
for
(
i
=
0
;
i
<
FLUSH_ITERATIONS
;
i
++
)
{
translog_flush
(
last_lsn
);
pthread_mutex_lock
(
&
LOCK_thread_count
);
ok
(
1
,
"-- flush %d"
,
param
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
}
pthread_mutex_lock
(
&
LOCK_thread_count
);
thread_count
--
;
ok
(
1
,
"flusher finished"
);
/* just to show progress */
VOID
(
pthread_cond_signal
(
&
COND_thread_count
));
/* Tell main we are
ready */
pthread_mutex_unlock
(
&
LOCK_thread_count
);
free
((
uchar
*
)
arg
);
my_thread_end
();
return
(
0
);
}
int
main
(
int
argc
__attribute__
((
unused
)),
char
**
argv
__attribute__
((
unused
)))
{
...
...
@@ -219,7 +269,8 @@ int main(int argc __attribute__((unused)),
int
*
param
,
error
;
int
rc
;
plan
(
WRITERS
+
ITERATIONS
*
WRITERS
*
3
);
plan
(
WRITERS
+
FLUSHERS
+
ITERATIONS
*
WRITERS
*
3
+
FLUSH_ITERATIONS
*
FLUSHERS
);
bzero
(
&
pagecache
,
sizeof
(
pagecache
));
maria_data_root
=
(
char
*
)
"."
;
...
...
@@ -329,19 +380,36 @@ int main(int argc __attribute__((unused)),
pthread_mutex_lock
(
&
LOCK_thread_count
);
while
(
number_of_writers
!=
0
)
while
(
number_of_writers
!=
0
||
number_of_flushers
!=
0
)
{
param
=
(
int
*
)
malloc
(
sizeof
(
int
));
*
param
=
number_of_writers
-
1
;
if
((
error
=
pthread_create
(
&
tid
,
&
thr_attr
,
test_thread_writer
,
(
void
*
)
param
)))
if
(
number_of_writers
)
{
fprintf
(
stderr
,
"Got error: %d from pthread_create (errno: %d)
\n
"
,
error
,
errno
);
exit
(
1
);
param
=
(
int
*
)
malloc
(
sizeof
(
int
));
*
param
=
number_of_writers
-
1
;
if
((
error
=
pthread_create
(
&
tid
,
&
thr_attr
,
test_thread_writer
,
(
void
*
)
param
)))
{
fprintf
(
stderr
,
"Got error: %d from pthread_create (errno: %d)
\n
"
,
error
,
errno
);
exit
(
1
);
}
thread_count
++
;
number_of_writers
--
;
}
if
(
number_of_flushers
)
{
param
=
(
int
*
)
malloc
(
sizeof
(
int
));
*
param
=
number_of_flushers
-
1
;
if
((
error
=
pthread_create
(
&
tid
,
&
thr_attr
,
test_thread_flusher
,
(
void
*
)
param
)))
{
fprintf
(
stderr
,
"Got error: %d from pthread_create (errno: %d)
\n
"
,
error
,
errno
);
exit
(
1
);
}
thread_count
++
;
number_of_flushers
--
;
}
thread_count
++
;
number_of_writers
--
;
}
pthread_mutex_unlock
(
&
LOCK_thread_count
);
...
...
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