~vlad-lesin/percona-server/i_s-innodb-log-tracking-status

« back to all changes in this revision

Viewing changes to Percona-Server/storage/innodb_plugin/log/log0online.c

  • Committer: Vlad Lesin
  • Date: 2012-11-08 15:24:56 UTC
  • Revision ID: vladislav.lesin@percona.com-20121108152456-fo5l7cd5ayoj7jtc
Holes detection is added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
320
320
        return result;
321
321
}
322
322
 
 
323
 
323
324
/****************************************************************//**
324
325
Safely write the log_sys->tracked_lsn value.  Uses atomic operations
325
326
if available, otherwise this field is protected with the log system
331
332
/*================*/
332
333
        ib_uint64_t     tracked_lsn)    /*!<in: new value */
333
334
{
334
 
#ifdef HAVE_ATOMIC_BUILTINS_64
335
 
        /* Single writer, no data race here */
336
 
        ib_uint64_t old_value
337
 
                = os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
338
 
        os_atomic_increment_uint64(&log_sys->tracked_lsn,
339
 
                                   tracked_lsn - old_value);
340
 
#else
341
 
        mutex_enter(&log_sys->mutex);
342
 
        log_sys->tracked_lsn = tracked_lsn;
343
 
        mutex_exit(&log_sys->mutex);
344
 
#endif
345
 
}
 
335
        log_set_thread_safe_uint64(&log_sys->tracked_lsn,
 
336
                                   tracked_lsn,
 
337
                                   &log_sys->mutex);
 
338
}
 
339
 
 
340
 
 
341
UNIV_INLINE
 
342
void
 
343
log_set_tracked_start_lsn(
 
344
/*================*/
 
345
        ib_uint64_t     tracked_start_lsn)      /*!<in: new value */
 
346
{
 
347
        log_set_thread_safe_uint64(&log_sys->tracked_start_lsn,
 
348
                                   tracked_start_lsn,
 
349
                                   &log_sys->mutex);
 
350
}
 
351
 
346
352
 
347
353
/****************************************************************//**
348
354
Diagnose a gap in tracked LSN range on server startup due to crash or
502
508
                "LSN %llu\n", tracking_start_lsn);
503
509
        log_bmp_sys->start_lsn = tracking_start_lsn;
504
510
        log_set_tracked_lsn(tracking_start_lsn);
 
511
        log_set_tracked_start_lsn(tracking_start_lsn);
 
512
        log_set_tracked_end_lsn(0);
505
513
}
506
514
 
507
515
/*********************************************************************//**
892
900
/*========================*/
893
901
{
894
902
        ib_uint64_t     contiguous_start_lsn;
 
903
        ib_uint64_t     tracking_end_lsn;
895
904
        log_group_t*    group;
896
905
 
897
906
        /* Grab the LSN of the last checkpoint, we will parse up to it */
903
912
                return;
904
913
        }
905
914
 
 
915
        tracking_end_lsn = log_get_tracked_end_lsn();
 
916
        if (tracking_end_lsn) {
 
917
                ut_print_timestamp(stderr);
 
918
                fprintf(stderr,
 
919
                        " InnoDB: Error: possible log tracking hole"
 
920
                        " from %llu to %llu LSN range.",
 
921
                        tracking_end_lsn, log_bmp_sys->start_lsn);
 
922
                log_set_tracked_end_lsn(0);
 
923
                log_set_tracked_start_lsn(log_bmp_sys->start_lsn);
 
924
        }
 
925
 
906
926
        group = UT_LIST_GET_FIRST(log_sys->log_groups);
907
927
        ut_a(group);
908
928