~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2011-02-12 08:10:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2161.
  • Revision ID: brian@tangent.org-20110212081017-7793i41ybt7gp5ty
More removal of session from includes.

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"
52
 
 
53
 
#include <drizzled/errmsg_print.h>
54
51
 
55
52
/*
56
53
General philosophy of InnoDB redo-logs:
362
359
}
363
360
 
364
361
/************************************************************//**
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
 
/************************************************************//**
398
362
Closes the log.
399
363
@return lsn */
400
364
UNIV_INTERN
463
427
                }
464
428
        }
465
429
 
466
 
        if (checkpoint_age <= log_max_modified_age_async()) {
 
430
        if (checkpoint_age <= log->max_modified_age_async) {
467
431
 
468
432
                goto function_exit;
469
433
        }
471
435
        oldest_lsn = buf_pool_get_oldest_modification();
472
436
 
473
437
        if (!oldest_lsn
474
 
            || lsn - oldest_lsn > log_max_modified_age_async()
475
 
            || checkpoint_age > log_max_checkpoint_age_async()) {
 
438
            || lsn - oldest_lsn > log->max_modified_age_async
 
439
            || checkpoint_age > log->max_checkpoint_age_async) {
476
440
 
477
441
                log->check_flush_or_checkpoint = TRUE;
478
442
        }
1136
1100
                group = (log_group_t*)((ulint)group - 1);
1137
1101
 
1138
1102
                if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
1139
 
                    && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
1140
1103
                    && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
1141
1104
 
1142
1105
                        fil_flush(group->space_id);
1158
1121
                        logs and cannot end up here! */
1159
1122
 
1160
1123
        if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
1161
 
            && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
1162
1124
            && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
1163
1125
            && srv_flush_log_at_trx_commit != 2) {
1164
1126
 
1392
1354
#endif /* UNIV_DEBUG */
1393
1355
        ulint           unlock;
1394
1356
 
1395
 
        if (recv_no_ibuf_operations || srv_fake_write) {
 
1357
        if (recv_no_ibuf_operations) {
1396
1358
                /* Recovery is running and no operations on the log files are
1397
1359
                allowed yet (the variable name .._no_ibuf_.. is misleading) */
1398
1360
 
1539
1501
 
1540
1502
        mutex_exit(&(log_sys->mutex));
1541
1503
 
1542
 
        if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC
1543
 
            || srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT) {
 
1504
        if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
1544
1505
                /* O_DSYNC means the OS did not buffer the log file at all:
1545
1506
                so we have also flushed to disk what we have written */
1546
1507
 
2159
2120
 
2160
2121
                sync = TRUE;
2161
2122
                advance = 2 * (age - log->max_modified_age_sync);
2162
 
        } else if (age > log_max_modified_age_async()) {
 
2123
        } else if (age > log->max_modified_age_async) {
2163
2124
 
2164
2125
                /* A flush is not urgent: we do an asynchronous preflush */
2165
 
                advance = age - log_max_modified_age_async();
 
2126
                advance = age - log->max_modified_age_async;
2166
2127
        } else {
2167
2128
                advance = 0;
2168
2129
        }
2176
2137
 
2177
2138
                do_checkpoint = TRUE;
2178
2139
 
2179
 
        } else if (checkpoint_age > log_max_checkpoint_age_async()) {
 
2140
        } else if (checkpoint_age > log->max_checkpoint_age_async) {
2180
2141
                /* A checkpoint is not urgent: do it asynchronously */
2181
2142
 
2182
2143
                do_checkpoint = TRUE;
3153
3114
        for the 'very fast' shutdown, because the InnoDB layer may have
3154
3115
        committed or prepared transactions and we don't want to lose them. */
3155
3116
 
3156
 
        if (! srv_apply_log_only) {
3157
3117
        if (trx_n_mysql_transactions > 0
3158
3118
            || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
3159
3119
 
3161
3121
 
3162
3122
                goto loop;
3163
3123
        }
3164
 
        }
3165
3124
 
3166
3125
        if (srv_fast_shutdown == 2) {
3167
3126
                /* In this fastest shutdown we do not flush the buffer pool:
3275
3234
        ut_a(lsn == log_sys->lsn);
3276
3235
 
3277
3236
        if (lsn < srv_start_lsn) {
3278
 
          drizzled::errmsg_printf(drizzled::error::ERROR,
3279
 
                                  "InnoDB: Error: log sequence number at shutdown %"PRIu64" is lower than at startup %"PRIu64"!",
3280
 
                                  lsn, srv_start_lsn);
 
3237
                fprintf(stderr,
 
3238
                        "InnoDB: Error: log sequence number"
 
3239
                        " at shutdown %"PRIu64"\n"
 
3240
                        "InnoDB: is lower than at startup %"PRIu64"!\n",
 
3241
                        lsn, srv_start_lsn);
3281
3242
        }
3282
3243
 
3283
3244
        srv_shutdown_lsn = lsn;
3388
3349
                log_sys->flushed_to_disk_lsn,
3389
3350
                log_sys->last_checkpoint_lsn);
3390
3351
 
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
 
 
3401
3352
        current_time = time(NULL);
3402
3353
 
3403
3354
        time_elapsed = 0.001 + difftime(current_time,