~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/log/log0log.cc

  • Committer: Brian Aker
  • Date: 2011-04-11 21:43:24 UTC
  • mfrom: (2263.7.1 percona-io-patches)
  • Revision ID: brian@gir-3.local-20110411214324-9n4egl89iws8kr5g
Tags: 2011.04.15
Merge in Innodb patch from Percona

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include "srv0start.h"
49
49
#include "trx0sys.h"
50
50
#include "trx0trx.h"
 
51
#include "ha_prototypes.h"
51
52
 
52
53
#include <drizzled/errmsg_print.h>
53
54
 
361
362
}
362
363
 
363
364
/************************************************************//**
 
365
*/
 
366
UNIV_INLINE
 
367
ulint
 
368
log_max_modified_age_async()
 
369
/*========================*/
 
370
{
 
371
  if (srv_checkpoint_age_target) {
 
372
    return(ut_min(log_sys->max_modified_age_async,
 
373
                  srv_checkpoint_age_target
 
374
                  - srv_checkpoint_age_target / 8));
 
375
  } else {
 
376
    return(log_sys->max_modified_age_async);
 
377
  }
 
378
}
 
379
 
 
380
/************************************************************//**
 
381
*/
 
382
UNIV_INLINE
 
383
ulint
 
384
log_max_checkpoint_age_async()
 
385
/*==========================*/
 
386
{
 
387
  if (srv_checkpoint_age_target) {
 
388
    return(ut_min(log_sys->max_checkpoint_age_async,
 
389
                  srv_checkpoint_age_target));
 
390
  } else {
 
391
    return(log_sys->max_checkpoint_age_async);
 
392
  }
 
393
}
 
394
 
 
395
 
 
396
 
 
397
/************************************************************//**
364
398
Closes the log.
365
399
@return lsn */
366
400
UNIV_INTERN
429
463
                }
430
464
        }
431
465
 
432
 
        if (checkpoint_age <= log->max_modified_age_async) {
 
466
        if (checkpoint_age <= log_max_modified_age_async()) {
433
467
 
434
468
                goto function_exit;
435
469
        }
437
471
        oldest_lsn = buf_pool_get_oldest_modification();
438
472
 
439
473
        if (!oldest_lsn
440
 
            || lsn - oldest_lsn > log->max_modified_age_async
441
 
            || checkpoint_age > log->max_checkpoint_age_async) {
 
474
            || lsn - oldest_lsn > log_max_modified_age_async()
 
475
            || checkpoint_age > log_max_checkpoint_age_async()) {
442
476
 
443
477
                log->check_flush_or_checkpoint = TRUE;
444
478
        }
1102
1136
                group = (log_group_t*)((ulint)group - 1);
1103
1137
 
1104
1138
                if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
 
1139
                    && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
1105
1140
                    && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
1106
1141
 
1107
1142
                        fil_flush(group->space_id);
1123
1158
                        logs and cannot end up here! */
1124
1159
 
1125
1160
        if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
 
1161
            && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
1126
1162
            && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
1127
1163
            && srv_flush_log_at_trx_commit != 2) {
1128
1164
 
1503
1539
 
1504
1540
        mutex_exit(&(log_sys->mutex));
1505
1541
 
1506
 
        if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
 
1542
        if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC
 
1543
            || srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT) {
1507
1544
                /* O_DSYNC means the OS did not buffer the log file at all:
1508
1545
                so we have also flushed to disk what we have written */
1509
1546
 
2122
2159
 
2123
2160
                sync = TRUE;
2124
2161
                advance = 2 * (age - log->max_modified_age_sync);
2125
 
        } else if (age > log->max_modified_age_async) {
 
2162
        } else if (age > log_max_modified_age_async()) {
2126
2163
 
2127
2164
                /* A flush is not urgent: we do an asynchronous preflush */
2128
 
                advance = age - log->max_modified_age_async;
 
2165
                advance = age - log_max_modified_age_async();
2129
2166
        } else {
2130
2167
                advance = 0;
2131
2168
        }
2139
2176
 
2140
2177
                do_checkpoint = TRUE;
2141
2178
 
2142
 
        } else if (checkpoint_age > log->max_checkpoint_age_async) {
 
2179
        } else if (checkpoint_age > log_max_checkpoint_age_async()) {
2143
2180
                /* A checkpoint is not urgent: do it asynchronously */
2144
2181
 
2145
2182
                do_checkpoint = TRUE;
3351
3388
                log_sys->flushed_to_disk_lsn,
3352
3389
                log_sys->last_checkpoint_lsn);
3353
3390
 
 
3391
        fprintf(file,
 
3392
                "Max checkpoint age    %lu\n"
 
3393
                "Checkpoint age target %lu\n"
 
3394
                "Modified age          %"PRIu64"\n"
 
3395
                "Checkpoint age        %"PRIu64"\n",
 
3396
                log_sys->max_checkpoint_age,
 
3397
                log_max_checkpoint_age_async(),
 
3398
                log_sys->lsn - log_buf_pool_get_oldest_modification(),
 
3399
                log_sys->lsn - log_sys->last_checkpoint_lsn);
 
3400
 
3354
3401
        current_time = time(NULL);
3355
3402
 
3356
3403
        time_elapsed = 0.001 + difftime(current_time,