~jobinau/drizzle/bug_654164

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-11-26 22:50:54 UTC
  • mfrom: (1953.1.6 build)
  • Revision ID: mordred@inaugust.com-20101126225054-sg90svw8579t5p3i
Stewart - InnoDB 1.1.1
Monty - Fixed some autoconf tests which were returning false positives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
/* Global log system variable */
83
83
UNIV_INTERN log_t*      log_sys = NULL;
84
84
 
 
85
#ifdef UNIV_PFS_RWLOCK
 
86
UNIV_INTERN mysql_pfs_key_t     checkpoint_lock_key;
 
87
# ifdef UNIV_LOG_ARCHIVE
 
88
UNIV_INTERN mysql_pfs_key_t     archive_lock_key;
 
89
# endif
 
90
#endif /* UNIV_PFS_RWLOCK */
 
91
 
 
92
#ifdef UNIV_PFS_MUTEX
 
93
UNIV_INTERN mysql_pfs_key_t     log_sys_mutex_key;
 
94
UNIV_INTERN mysql_pfs_key_t     log_flush_order_mutex_key;
 
95
#endif /* UNIV_PFS_MUTEX */
 
96
 
85
97
#ifdef UNIV_DEBUG
86
98
UNIV_INTERN ibool       log_do_write = TRUE;
87
99
#endif /* UNIV_DEBUG */
756
768
{
757
769
        log_sys = mem_alloc(sizeof(log_t));
758
770
 
759
 
        mutex_create(&log_sys->mutex, SYNC_LOG);
 
771
        mutex_create(log_sys_mutex_key, &log_sys->mutex, SYNC_LOG);
 
772
 
 
773
        mutex_create(log_flush_order_mutex_key,
 
774
                     &log_sys->log_flush_order_mutex,
 
775
                     SYNC_LOG_FLUSH_ORDER);
760
776
 
761
777
        mutex_enter(&(log_sys->mutex));
762
778
 
812
828
        log_sys->last_checkpoint_lsn = log_sys->lsn;
813
829
        log_sys->n_pending_checkpoint_writes = 0;
814
830
 
815
 
        rw_lock_create(&log_sys->checkpoint_lock, SYNC_NO_ORDER_CHECK);
 
831
        rw_lock_create(checkpoint_lock_key, &log_sys->checkpoint_lock,
 
832
                       SYNC_NO_ORDER_CHECK);
816
833
 
817
834
        log_sys->checkpoint_buf_ptr = mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE);
818
835
        log_sys->checkpoint_buf = ut_align(log_sys->checkpoint_buf_ptr,
828
845
 
829
846
        log_sys->n_pending_archive_ios = 0;
830
847
 
831
 
        rw_lock_create(&log_sys->archive_lock, SYNC_NO_ORDER_CHECK);
 
848
        rw_lock_create(archive_lock_key, &log_sys->archive_lock,
 
849
                       SYNC_NO_ORDER_CHECK);
832
850
 
833
851
        log_sys->archive_buf = NULL;
834
852
 
1637
1655
                recv_apply_hashed_log_recs(TRUE);
1638
1656
        }
1639
1657
 
1640
 
        n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX, new_oldest);
 
1658
        n_pages = buf_flush_list(ULINT_MAX, new_oldest);
1641
1659
 
1642
1660
        if (sync) {
1643
 
                buf_flush_wait_batch_end(BUF_FLUSH_LIST);
 
1661
                buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
1644
1662
        }
1645
1663
 
1646
1664
        if (n_pages == ULINT_UNDEFINED) {
2354
2372
                log_archived_file_name_gen(name, group->id,
2355
2373
                                           group->archived_file_no + n_files);
2356
2374
 
2357
 
                file_handle = os_file_create(name, open_mode, OS_FILE_AIO,
 
2375
                file_handle = os_file_create(innodb_file_log_key,
 
2376
                                             name, open_mode,
 
2377
                                             OS_FILE_AIO,
2358
2378
                                             OS_DATA_FILE, &ret);
2359
2379
 
2360
2380
                if (!ret && (open_mode == OS_FILE_CREATE)) {
2361
2381
                        file_handle = os_file_create(
2362
 
                                name, OS_FILE_OPEN, OS_FILE_AIO,
2363
 
                                OS_DATA_FILE, &ret);
 
2382
                                innodb_file_log_key, name, OS_FILE_OPEN,
 
2383
                                OS_FILE_AIO, OS_DATA_FILE, &ret);
2364
2384
                }
2365
2385
 
2366
2386
                if (!ret) {
3111
3131
                return; /* We SKIP ALL THE REST !! */
3112
3132
        }
3113
3133
 
3114
 
        /* Check that the master thread is suspended */
3115
 
 
3116
 
        if (srv_n_threads_active[SRV_MASTER] != 0) {
3117
 
 
3118
 
                mutex_exit(&kernel_mutex);
3119
 
 
 
3134
        mutex_exit(&kernel_mutex);
 
3135
 
 
3136
        /* Check that the background threads are suspended */
 
3137
 
 
3138
        if (srv_is_any_background_thread_active()) {
3120
3139
                goto loop;
3121
3140
        }
3122
3141
 
3123
 
        mutex_exit(&kernel_mutex);
3124
 
 
3125
3142
        mutex_enter(&(log_sys->mutex));
3126
3143
 
3127
3144
        if (log_sys->n_pending_checkpoint_writes
3179
3196
 
3180
3197
        mutex_exit(&(log_sys->mutex));
3181
3198
 
3182
 
        mutex_enter(&kernel_mutex);
3183
 
        /* Check that the master thread has stayed suspended */
3184
 
        if (srv_n_threads_active[SRV_MASTER] != 0) {
 
3199
        /* Check that the background threads stay suspended */
 
3200
        if (srv_is_any_background_thread_active()) {
3185
3201
                fprintf(stderr,
3186
 
                        "InnoDB: Warning: the master thread woke up"
 
3202
                        "InnoDB: Warning: some background thread woke up"
3187
3203
                        " during shutdown\n");
3188
3204
 
3189
 
                mutex_exit(&kernel_mutex);
3190
 
 
3191
3205
                goto loop;
3192
3206
        }
3193
 
        mutex_exit(&kernel_mutex);
3194
3207
 
3195
3208
        fil_flush_file_spaces(FIL_TABLESPACE);
3196
3209
        fil_flush_file_spaces(FIL_LOG);
3208
3221
        srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
3209
3222
 
3210
3223
        /* Make some checks that the server really is quiet */
3211
 
        ut_a(srv_n_threads_active[SRV_MASTER] == 0);
 
3224
        ut_a(!srv_is_any_background_thread_active());
 
3225
 
3212
3226
        ut_a(buf_all_freed());
3213
3227
        ut_a(lsn == log_sys->lsn);
3214
3228
 
3229
3243
        fil_close_all_files();
3230
3244
 
3231
3245
        /* Make some checks that the server really is quiet */
3232
 
        ut_a(srv_n_threads_active[SRV_MASTER] == 0);
 
3246
        ut_a(!srv_is_any_background_thread_active());
 
3247
 
3233
3248
        ut_a(buf_all_freed());
3234
3249
        ut_a(lsn == log_sys->lsn);
3235
3250
}
3270
3285
 
3271
3286
        ut_memcpy(scan_buf, start, end - start);
3272
3287
 
3273
 
        recv_scan_log_recs((buf_pool->curr_size
3274
 
                            - recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
3275
 
                           FALSE, scan_buf, end - start,
 
3288
        recv_scan_log_recs((buf_pool_get_n_pages()
 
3289
                           - (recv_n_pool_free_frames * srv_buf_pool_instances))
 
3290
                           * UNIV_PAGE_SIZE, FALSE, scan_buf, end - start,
3276
3291
                           ut_uint64_align_down(buf_start_lsn,
3277
3292
                                                OS_FILE_LOG_BLOCK_SIZE),
3278
3293
                           &contiguous_lsn, &scanned_lsn);