Merge lp:~skinny.moey/drizzle/user_scoreboard into lp:~drizzle-trunk/drizzle/development

Proposed by Joe Daly
Status: Merged
Merged at revision: not available
Proposed branch: lp:~skinny.moey/drizzle/user_scoreboard
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 37 lines (+4/-2)
1 file modified
plugin/logging_stats/logging_stats.cc (+4/-2)
To merge this branch: bzr merge lp:~skinny.moey/drizzle/user_scoreboard
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Monty Taylor Approve
Brian Aker Pending
Review via email: mp+22513@code.launchpad.net

Description of the change

The logging_stats.slap test was failing on OSX, the locks were mistakenly not being init'd or destroyed. It "seemed" to work on the other platforms but debug code definitely showed the lock not doing anything on OSX (hades) when it was not init'd, too bad it didnt crash that would have been easier to locate.

This change also adds a change to ignore session 0 as only the postEnd() method gets called and not the post() method for this session, I assume this is because of how the initial plugins storage engine connection is made.

I will re-visit the locks in my next patch for this code, as one of them should be able to be removed.

To post a comment you must log in.
Revision history for this message
Joe Daly (skinny.moey) wrote :

removed cout statements, those were not to be in the review.

Revision history for this message
Monty Taylor (mordred) wrote :

Wow. Yeah - now that you point it out, that makes perfect sense.

Good catch!

review: Approve
Revision history for this message
Jay Pipes (jaypipes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugin/logging_stats/logging_stats.cc'
2--- plugin/logging_stats/logging_stats.cc 2010-03-25 02:26:39 +0000
3+++ plugin/logging_stats/logging_stats.cc 2010-03-31 03:26:28 +0000
4@@ -73,6 +73,7 @@
5
6 LoggingStats::LoggingStats(string name_arg) : Logging(name_arg)
7 {
8+ (void) pthread_rwlock_init(&LOCK_scoreboard, NULL);
9 scoreboard_size= sysvar_logging_stats_scoreboard_size;
10 score_board_slots= new ScoreBoardSlot[scoreboard_size];
11 for (uint32_t j=0; j < scoreboard_size; j++)
12@@ -85,6 +86,7 @@
13
14 LoggingStats::~LoggingStats()
15 {
16+ (void) pthread_rwlock_destroy(&LOCK_scoreboard);
17 delete[] score_board_slots;
18 }
19
20@@ -152,7 +154,7 @@
21
22 bool LoggingStats::post(Session *session)
23 {
24- if (! isEnabled())
25+ if (! isEnabled() || (session->getSessionId() == 0))
26 {
27 return false;
28 }
29@@ -225,7 +227,7 @@
30
31 bool LoggingStats::postEnd(Session *session)
32 {
33- if (! isEnabled())
34+ if (! isEnabled() || (session->getSessionId() == 0))
35 {
36 return false;
37 }