~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/log0log.ic

  • Committer: Brian Aker
  • Date: 2010-11-19 19:42:44 UTC
  • mto: (1945.2.1 quick)
  • mto: This revision was merged to the branch mainline in revision 1944.
  • Revision ID: brian@tangent.org-20101119194244-7vx6u5vwzvu9uvex
Remove dead getShare() call which should have been a call on the cache
directly.

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, 2010, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
27
27
#include "mach0data.h"
28
28
#include "mtr0mtr.h"
29
29
 
 
30
#ifdef UNIV_LOG_DEBUG
30
31
/******************************************************//**
31
32
Checks by parsing that the catenated log segment for a single mtr is
32
33
consistent. */
34
35
ibool
35
36
log_check_log_recs(
36
37
/*===============*/
37
 
        byte*           buf,            /*!< in: pointer to the start of
 
38
        const byte*     buf,            /*!< in: pointer to the start of
38
39
                                        the log segment in the
39
40
                                        log_sys->buf log buffer */
40
41
        ulint           len,            /*!< in: segment length in bytes */
41
42
        ib_uint64_t     buf_start_lsn); /*!< in: buffer start lsn */
 
43
#endif /* UNIV_LOG_DEBUG */
42
44
 
43
45
/************************************************************//**
44
46
Gets a log block flush bit.
305
307
ib_uint64_t
306
308
log_reserve_and_write_fast(
307
309
/*=======================*/
308
 
        byte*           str,    /*!< in: string */
 
310
        const void*     str,    /*!< in: string */
309
311
        ulint           len,    /*!< in: string length */
310
 
        ib_uint64_t*    start_lsn,/*!< out: start lsn of the log record */
311
 
        ibool*          success)/*!< out: TRUE if success */
 
312
        ib_uint64_t*    start_lsn)/*!< out: start lsn of the log record */
312
313
{
313
 
        log_t*          log     = log_sys;
314
314
        ulint           data_len;
315
 
        ib_uint64_t     lsn;
316
 
 
317
 
        *success = TRUE;
318
 
 
319
 
        mutex_enter(&(log->mutex));
320
 
 
321
 
        data_len = len + log->buf_free % OS_FILE_LOG_BLOCK_SIZE;
 
315
#ifdef UNIV_LOG_LSN_DEBUG
 
316
        /* length of the LSN pseudo-record */
 
317
        ulint           lsn_len;
 
318
#endif /* UNIV_LOG_LSN_DEBUG */
 
319
 
 
320
        mutex_enter(&log_sys->mutex);
 
321
#ifdef UNIV_LOG_LSN_DEBUG
 
322
        lsn_len = 1
 
323
                + mach_get_compressed_size(log_sys->lsn >> 32)
 
324
                + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
 
325
#endif /* UNIV_LOG_LSN_DEBUG */
 
326
 
 
327
        data_len = len
 
328
#ifdef UNIV_LOG_LSN_DEBUG
 
329
                + lsn_len
 
330
#endif /* UNIV_LOG_LSN_DEBUG */
 
331
                + log_sys->buf_free % OS_FILE_LOG_BLOCK_SIZE;
322
332
 
323
333
        if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
324
334
 
325
335
                /* The string does not fit within the current log block
326
336
                or the log block would become full */
327
337
 
328
 
                *success = FALSE;
329
 
 
330
 
                mutex_exit(&(log->mutex));
 
338
                mutex_exit(&log_sys->mutex);
331
339
 
332
340
                return(0);
333
341
        }
334
342
 
335
 
        *start_lsn = log->lsn;
336
 
 
337
 
        ut_memcpy(log->buf + log->buf_free, str, len);
338
 
 
339
 
        log_block_set_data_len((byte*) ut_align_down(log->buf + log->buf_free,
 
343
        *start_lsn = log_sys->lsn;
 
344
 
 
345
#ifdef UNIV_LOG_LSN_DEBUG
 
346
        {
 
347
                /* Write the LSN pseudo-record. */
 
348
                byte* b = &log_sys->buf[log_sys->buf_free];
 
349
                *b++ = MLOG_LSN | (MLOG_SINGLE_REC_FLAG & *(const byte*) str);
 
350
                /* Write the LSN in two parts,
 
351
                as a pseudo page number and space id. */
 
352
                b += mach_write_compressed(b, log_sys->lsn >> 32);
 
353
                b += mach_write_compressed(b, log_sys->lsn & 0xFFFFFFFFUL);
 
354
                ut_a(b - lsn_len == &log_sys->buf[log_sys->buf_free]);
 
355
 
 
356
                memcpy(b, str, len);
 
357
                len += lsn_len;
 
358
        }
 
359
#else /* UNIV_LOG_LSN_DEBUG */
 
360
        memcpy(log_sys->buf + log_sys->buf_free, str, len);
 
361
#endif /* UNIV_LOG_LSN_DEBUG */
 
362
 
 
363
        log_block_set_data_len((byte*) ut_align_down(log_sys->buf
 
364
                                                     + log_sys->buf_free,
340
365
                                                     OS_FILE_LOG_BLOCK_SIZE),
341
366
                               data_len);
342
367
#ifdef UNIV_LOG_DEBUG
343
 
        log->old_buf_free = log->buf_free;
344
 
        log->old_lsn = log->lsn;
 
368
        log_sys->old_buf_free = log_sys->buf_free;
 
369
        log_sys->old_lsn = log_sys->lsn;
345
370
#endif
346
 
        log->buf_free += len;
347
 
 
348
 
        ut_ad(log->buf_free <= log->buf_size);
349
 
 
350
 
        lsn = log->lsn += len;
 
371
        log_sys->buf_free += len;
 
372
 
 
373
        ut_ad(log_sys->buf_free <= log_sys->buf_size);
 
374
 
 
375
        log_sys->lsn += len;
351
376
 
352
377
#ifdef UNIV_LOG_DEBUG
353
 
        log_check_log_recs(log->buf + log->old_buf_free,
354
 
                           log->buf_free - log->old_buf_free, log->old_lsn);
 
378
        log_check_log_recs(log_sys->buf + log_sys->old_buf_free,
 
379
                           log_sys->buf_free - log_sys->old_buf_free,
 
380
                           log_sys->old_lsn);
355
381
#endif
356
 
        return(lsn);
 
382
        return(log_sys->lsn);
357
383
}
358
384
 
359
385
/***********************************************************************//**