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
531a78f1
Commit
531a78f1
authored
Dec 13, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
postreview changes.
storage/maria/ma_loghandler.c: Using pthread_cond instead of WQUEUE.
parent
6b89901c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
storage/maria/ma_loghandler.c
storage/maria/ma_loghandler.c
+9
-16
No files found.
storage/maria/ma_loghandler.c
View file @
531a78f1
...
@@ -83,7 +83,7 @@ struct st_translog_buffer
...
@@ -83,7 +83,7 @@ struct st_translog_buffer
/* File handler for this buffer */
/* File handler for this buffer */
File
file
;
File
file
;
/* Threads which are waiting for buffer filling/freeing */
/* Threads which are waiting for buffer filling/freeing */
WQUEUE
waiting_filling_buffer
;
pthread_cond_t
waiting_filling_buffer
;
/* Number of records which are in copy progress */
/* Number of records which are in copy progress */
uint
copy_to_buffer_in_progress
;
uint
copy_to_buffer_in_progress
;
/* list of waiting buffer ready threads */
/* list of waiting buffer ready threads */
...
@@ -1182,7 +1182,8 @@ static my_bool translog_buffer_init(struct st_translog_buffer *buffer)
...
@@ -1182,7 +1182,8 @@ static my_bool translog_buffer_init(struct st_translog_buffer *buffer)
/* Buffer size */
/* Buffer size */
buffer
->
size
=
0
;
buffer
->
size
=
0
;
/* cond of thread which is waiting for buffer filling */
/* cond of thread which is waiting for buffer filling */
buffer
->
waiting_filling_buffer
.
last_thread
=
0
;
if
(
pthread_cond_init
(
&
buffer
->
waiting_filling_buffer
,
0
))
DBUG_RETURN
(
1
);
/* Number of records which are in copy progress */
/* Number of records which are in copy progress */
buffer
->
copy_to_buffer_in_progress
=
0
;
buffer
->
copy_to_buffer_in_progress
=
0
;
/* list of waiting buffer ready threads */
/* list of waiting buffer ready threads */
...
@@ -1555,7 +1556,6 @@ static void translog_finish_page(TRANSLOG_ADDRESS *horizon,
...
@@ -1555,7 +1556,6 @@ static void translog_finish_page(TRANSLOG_ADDRESS *horizon,
static
void
translog_wait_for_writers
(
struct
st_translog_buffer
*
buffer
)
static
void
translog_wait_for_writers
(
struct
st_translog_buffer
*
buffer
)
{
{
struct
st_my_thread_var
*
thread
=
my_thread_var
;
DBUG_ENTER
(
"translog_wait_for_writers"
);
DBUG_ENTER
(
"translog_wait_for_writers"
);
DBUG_PRINT
(
"enter"
,
(
"Buffer #%u 0x%lx copies in progress: %u"
,
DBUG_PRINT
(
"enter"
,
(
"Buffer #%u 0x%lx copies in progress: %u"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
,
...
@@ -1567,8 +1567,7 @@ static void translog_wait_for_writers(struct st_translog_buffer *buffer)
...
@@ -1567,8 +1567,7 @@ static void translog_wait_for_writers(struct st_translog_buffer *buffer)
DBUG_PRINT
(
"info"
,
(
"wait for writers... buffer: #%u 0x%lx"
,
DBUG_PRINT
(
"info"
,
(
"wait for writers... buffer: #%u 0x%lx"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
DBUG_ASSERT
(
buffer
->
file
!=
-
1
);
DBUG_ASSERT
(
buffer
->
file
!=
-
1
);
wqueue_add_and_wait
(
&
buffer
->
waiting_filling_buffer
,
thread
,
pthread_cond_wait
(
&
buffer
->
waiting_filling_buffer
,
&
buffer
->
mutex
);
&
buffer
->
mutex
);
DBUG_PRINT
(
"info"
,
(
"wait for writers done buffer: #%u 0x%lx"
,
DBUG_PRINT
(
"info"
,
(
"wait for writers done buffer: #%u 0x%lx"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
}
}
...
@@ -1591,7 +1590,6 @@ static void translog_wait_for_writers(struct st_translog_buffer *buffer)
...
@@ -1591,7 +1590,6 @@ static void translog_wait_for_writers(struct st_translog_buffer *buffer)
static
void
translog_wait_for_buffer_free
(
struct
st_translog_buffer
*
buffer
)
static
void
translog_wait_for_buffer_free
(
struct
st_translog_buffer
*
buffer
)
{
{
struct
st_my_thread_var
*
thread
=
my_thread_var
;
DBUG_ENTER
(
"translog_wait_for_buffer_free"
);
DBUG_ENTER
(
"translog_wait_for_buffer_free"
);
DBUG_PRINT
(
"enter"
,
(
"Buffer: #%u 0x%lx copies in progress: %u "
DBUG_PRINT
(
"enter"
,
(
"Buffer: #%u 0x%lx copies in progress: %u "
"File: %d size: 0x%lu"
,
"File: %d size: 0x%lu"
,
...
@@ -1605,8 +1603,7 @@ static void translog_wait_for_buffer_free(struct st_translog_buffer *buffer)
...
@@ -1605,8 +1603,7 @@ static void translog_wait_for_buffer_free(struct st_translog_buffer *buffer)
{
{
DBUG_PRINT
(
"info"
,
(
"wait for writers... buffer: #%u 0x%lx"
,
DBUG_PRINT
(
"info"
,
(
"wait for writers... buffer: #%u 0x%lx"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
wqueue_add_and_wait
(
&
buffer
->
waiting_filling_buffer
,
thread
,
pthread_cond_wait
(
&
buffer
->
waiting_filling_buffer
,
&
buffer
->
mutex
);
&
buffer
->
mutex
);
DBUG_PRINT
(
"info"
,
(
"wait for writers done. buffer: #%u 0x%lx"
,
DBUG_PRINT
(
"info"
,
(
"wait for writers done. buffer: #%u 0x%lx"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
));
}
}
...
@@ -2147,10 +2144,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
...
@@ -2147,10 +2144,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
/* Free buffer */
/* Free buffer */
buffer
->
file
=
-
1
;
buffer
->
file
=
-
1
;
buffer
->
overlay
=
0
;
buffer
->
overlay
=
0
;
if
(
buffer
->
waiting_filling_buffer
.
last_thread
)
pthread_cond_broadcast
(
&
buffer
->
waiting_filling_buffer
);
{
wqueue_release_queue
(
&
buffer
->
waiting_filling_buffer
);
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -3322,7 +3316,6 @@ static void translog_buffer_destroy(struct st_translog_buffer *buffer)
...
@@ -3322,7 +3316,6 @@ static void translog_buffer_destroy(struct st_translog_buffer *buffer)
buffer
->
file
,
buffer
->
file
,
LSN_IN_PARTS
(
buffer
->
offset
),
LSN_IN_PARTS
(
buffer
->
offset
),
(
ulong
)
buffer
->
size
));
(
ulong
)
buffer
->
size
));
DBUG_ASSERT
(
buffer
->
waiting_filling_buffer
.
last_thread
==
0
);
if
(
buffer
->
file
!=
-
1
)
if
(
buffer
->
file
!=
-
1
)
{
{
/*
/*
...
@@ -3335,6 +3328,7 @@ static void translog_buffer_destroy(struct st_translog_buffer *buffer)
...
@@ -3335,6 +3328,7 @@ static void translog_buffer_destroy(struct st_translog_buffer *buffer)
}
}
DBUG_PRINT
(
"info"
,
(
"Destroy mutex: 0x%lx"
,
(
ulong
)
&
buffer
->
mutex
));
DBUG_PRINT
(
"info"
,
(
"Destroy mutex: 0x%lx"
,
(
ulong
)
&
buffer
->
mutex
));
pthread_mutex_destroy
(
&
buffer
->
mutex
);
pthread_mutex_destroy
(
&
buffer
->
mutex
);
pthread_cond_destroy
(
&
buffer
->
waiting_filling_buffer
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -3671,9 +3665,8 @@ static void translog_buffer_decrease_writers(struct st_translog_buffer *buffer)
...
@@ -3671,9 +3665,8 @@ static void translog_buffer_decrease_writers(struct st_translog_buffer *buffer)
(
"copy_to_buffer_in_progress. Buffer #%u 0x%lx progress: %d"
,
(
"copy_to_buffer_in_progress. Buffer #%u 0x%lx progress: %d"
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
,
(
uint
)
buffer
->
buffer_no
,
(
ulong
)
buffer
,
buffer
->
copy_to_buffer_in_progress
));
buffer
->
copy_to_buffer_in_progress
));
if
(
buffer
->
copy_to_buffer_in_progress
==
0
&&
if
(
buffer
->
copy_to_buffer_in_progress
==
0
)
buffer
->
waiting_filling_buffer
.
last_thread
!=
NULL
)
pthread_cond_broadcast
(
&
buffer
->
waiting_filling_buffer
);
wqueue_release_queue
(
&
buffer
->
waiting_filling_buffer
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
...
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