~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/sync/sync0arr.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
715
715
                                        fprintf(stderr, "rw-lock %p ",
716
716
                                                (void*) lock);
717
717
                                        sync_array_cell_print(stderr, cell);
718
 
                                        rw_lock_debug_print(debug);
 
718
                                        rw_lock_debug_print(stderr, debug);
719
719
                                        return(TRUE);
720
720
                                }
721
721
                        }
914
914
@return TRUE if fatal semaphore wait threshold was exceeded */
915
915
UNIV_INTERN
916
916
ibool
917
 
sync_array_print_long_waits(void)
918
 
/*=============================*/
 
917
sync_array_print_long_waits(
 
918
/*========================*/
 
919
        os_thread_id_t* waiter, /*!< out: longest waiting thread */
 
920
        const void**    sema)   /*!< out: longest-waited-for semaphore */
919
921
{
920
922
        sync_cell_t*    cell;
921
923
        ibool           old_val;
923
925
        ulint           i;
924
926
        ulint           fatal_timeout = srv_fatal_semaphore_wait_threshold;
925
927
        ibool           fatal = FALSE;
 
928
        double          longest_diff = 0;
926
929
 
927
930
        for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
928
931
 
 
932
                double  diff;
 
933
                void*   wait_object;
 
934
 
929
935
                cell = sync_array_get_nth_cell(sync_primary_wait_array, i);
930
936
 
931
 
                if (cell->wait_object != NULL && cell->waiting
932
 
                    && difftime(time(NULL), cell->reservation_time) > 240) {
 
937
                wait_object = cell->wait_object;
 
938
 
 
939
                if (wait_object == NULL || !cell->waiting) {
 
940
 
 
941
                        continue;
 
942
                }
 
943
 
 
944
                diff = difftime(time(NULL), cell->reservation_time);
 
945
 
 
946
                if (diff > 240) {
933
947
                        fputs("InnoDB: Warning: a long semaphore wait:\n",
934
948
                              stderr);
935
949
                        sync_array_cell_print(stderr, cell);
936
950
                        noticed = TRUE;
937
951
                }
938
952
 
939
 
                if (cell->wait_object != NULL && cell->waiting
940
 
                    && difftime(time(NULL), cell->reservation_time)
941
 
                    > fatal_timeout) {
 
953
                if (diff > fatal_timeout) {
942
954
                        fatal = TRUE;
943
955
                }
 
956
 
 
957
                if (diff > longest_diff) {
 
958
                        longest_diff = diff;
 
959
                        *sema = wait_object;
 
960
                        *waiter = cell->thread;
 
961
                }
944
962
        }
945
963
 
946
964
        if (noticed) {