Steve,
it looks and works great (even under valgrind where original logsys
failed very quickly), but I found one problem on systems without shared
posix semaphores. Does that semaphore need to be shared (between
processes?). If not, use attached patch.
Regards,
Honza
Steven Dake wrote:
> Hello,
>
> Well I feel this patch is a fairly complete but in need of review. I
> focused on removing complexity from the flight record code path since it
> happens often and logging less so.
>
> The major changes are as follows:
> 1) instead of log output coming out of the flight record, a separate
> record is created for each log message that should be sent to a log
> target
> 2) sem_wait and sem_post are used to properly count outstanding
> messages. I could have used a counting conditional pthread mutex but
> that is way more complicated
> 3) the custom memcpy garbage is gone
> 4) the flight record is created as a memory mapped area where the first
> part of the map is mapped onto the second. This allows us to use memcpy
> without having to worry about wrapping. Instead we let the memory
> manager of the OS handle it.
> 5) Each and every message is logged in the flight record even debug
> messages (without debug being set). This may mean we want to increase
> the default size of our flight record.
>
> performance is dramatically better as well and no wierd segfaults
> crashes or other badness.
>
> This passes the test cases that were previously failing
> set debug: on
>
> service corosync start
> test/cpgbench &
> sleep 60
> service corosync stop
>
> Corosync stop promptly now without losing any messages.
>
> Could really use some nit-picking review and some suggestions around
> setting/handling memory overflow for the logging messages.
>
> Regards
> -steve
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
diff --git a/trunk/exec/logsys.c b/trunk/exec/logsys.c
index 36c3d8d..dc4e1d6 100644
--- a/trunk/exec/logsys.c
+++ b/trunk/exec/logsys.c
@@ -1068,9 +1068,9 @@ int _logsys_rec_init (unsigned int fltsize)
{
size_t flt_real_size;
- sem_init (&logsys_thread_start, 1, 0);
+ sem_init (&logsys_thread_start, 0, 0);
- sem_init (&logsys_print_finished, 1, 0);
+ sem_init (&logsys_print_finished, 0, 0);
#if defined(HAVE_PTHREAD_SPIN_LOCK)
pthread_spin_init (&logsys_flt_spinlock, 1);
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais