~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/trx0sys.h

  • Committer: Lee Bieber
  • Date: 2010-10-27 18:28:56 UTC
  • mfrom: (1883.1.3 build)
  • Revision ID: kalebral@gmail.com-20101027182856-q3wqtbv1t4egkjsk
Merge Andrew - fix bug 667360: --defaults-file not processed before paths read           
Merge Andrew - fix bug 656577: Importing SQL script results in silent failure    
Merge Andrew - fix bug 667053: drizzledump minor output cleanup needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1996, 2009, 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
41
41
#include "read0types.h"
42
42
#include "page0types.h"
43
43
 
44
 
#include <drizzled/atomics.h>
 
44
/** In a MySQL replication slave, in crash recovery we store the master log
 
45
file name and position here. */
 
46
/* @{ */
 
47
/** Master binlog file name */
 
48
extern char             trx_sys_mysql_master_log_name[];
 
49
/** Master binlog file position.  We have successfully got the updates
 
50
up to this position.  -1 means that no crash recovery was needed, or
 
51
there was no master log position info inside InnoDB.*/
 
52
extern ib_int64_t       trx_sys_mysql_master_log_pos;
 
53
/* @} */
45
54
 
46
 
/** the highest commit identifier assigned in the system */
47
 
extern drizzled::atomic<uint64_t> trx_sys_commit_id; 
 
55
/** If this MySQL server uses binary logging, after InnoDB has been inited
 
56
and if it has done a crash recovery, we store the binlog file name and position
 
57
here. */
 
58
/* @{ */
 
59
/** Binlog file name */
 
60
extern char             trx_sys_mysql_bin_log_name[];
 
61
/** Binlog file position, or -1 if unknown */
 
62
extern ib_int64_t       trx_sys_mysql_bin_log_pos;
 
63
/* @} */
48
64
 
49
65
/** The transaction system */
50
66
extern trx_sys_t*       trx_sys;
269
285
/*============*/
270
286
        trx_t*  in_trx);/*!< in: trx */
271
287
/*****************************************************************//**
272
 
Writes to the sys header file the latest commit_id in the system */ 
 
288
Updates the offset information about the end of the MySQL binlog entry
 
289
which corresponds to the transaction just being committed. In a MySQL
 
290
replication slave updates the latest master binlog position up to which
 
291
replication has proceeded. */
273
292
UNIV_INTERN
274
293
void
275
 
trx_sys_flush_commit_id(uint64_t commit_id, ulint field, mtr_t* mtr);
 
294
trx_sys_update_mysql_binlog_offset(
 
295
/*===============================*/
 
296
        const char*     file_name,/*!< in: MySQL log file name */
 
297
        ib_int64_t      offset, /*!< in: position in that log file */
 
298
        ulint           field,  /*!< in: offset of the MySQL log info field in
 
299
                                the trx sys header */
 
300
        mtr_t*          mtr);   /*!< in: mtr */
276
301
/*****************************************************************//**
277
 
Reads the latest commit_id into trx_sys_commit_id */
 
302
Prints to stderr the MySQL binlog offset info in the trx system header if
 
303
the magic number shows it valid. */
278
304
UNIV_INTERN
279
305
void
280
 
trx_sys_read_commit_id(void);
 
306
trx_sys_print_mysql_binlog_offset(void);
 
307
/*===================================*/
281
308
/*****************************************************************//**
282
309
Prints to stderr the MySQL master log offset info in the trx system header if
283
310
the magic number shows it valid. */
306
333
void
307
334
trx_sys_file_format_tag_init(void);
308
335
/*==============================*/
309
 
#ifndef UNIV_HOTBACKUP
310
336
/*****************************************************************//**
311
337
Shutdown/Close the transaction system. */
312
338
UNIV_INTERN
313
339
void
314
340
trx_sys_close(void);
315
341
/*===============*/
316
 
#endif /* !UNIV_HOTBACKUP */
317
342
/*****************************************************************//**
318
343
Get the name representation of the file format from its id.
319
344
@return pointer to the name */
360
385
        ulint           format_id);     /*!< in: file format identifier */
361
386
#else /* !UNIV_HOTBACKUP */
362
387
/*****************************************************************//**
 
388
Prints to stderr the MySQL binlog info in the system header if the
 
389
magic number shows it valid. */
 
390
UNIV_INTERN
 
391
void
 
392
trx_sys_print_mysql_binlog_offset_from_page(
 
393
/*========================================*/
 
394
        const byte*     page);  /*!< in: buffer containing the trx
 
395
                                system header page, i.e., page number
 
396
                                TRX_SYS_PAGE_NO in the tablespace */
 
397
/*****************************************************************//**
363
398
Reads the file format id from the first system table space file.
364
399
Even if the call succeeds and returns TRUE, the returned format id
365
400
may be ULINT_UNDEFINED signalling that the format id was not present
394
429
        const ulint     id);    /*!< in: id of the file format */
395
430
 
396
431
#endif /* !UNIV_HOTBACKUP */
397
 
/*********************************************************************
398
 
Creates the rollback segments */
399
 
UNIV_INTERN
400
 
void
401
 
trx_sys_create_rsegs(
402
 
/*=================*/
403
 
        ulint   n_rsegs);       /*!< number of rollback segments to create */
404
 
 
405
432
/* The automatically created system rollback segment has this id */
406
433
#define TRX_SYS_SYSTEM_RSEG_ID  0
407
434
 
436
463
                                        slots */
437
464
/*------------------------------------------------------------- @} */
438
465
 
439
 
/* Max number of rollback segments: the number of segment specification slots
440
 
in the transaction system array; rollback segment id must fit in one (signed)
441
 
byte, therefore 128; each slot is currently 8 bytes in size. If you want
442
 
to raise the level to 256 then you will need to fix some assertions that
443
 
impose the 7 bit restriction. e.g., mach_write_to_3() */
444
 
#define TRX_SYS_N_RSEGS                 128
445
 
/* Originally, InnoDB defined TRX_SYS_N_RSEGS as 256 but created only one
446
 
rollback segment.  It initialized some arrays with this number of entries.
447
 
We must remember this limit in order to keep file compatibility. */
448
 
#define TRX_SYS_OLD_N_RSEGS             256
 
466
/** Maximum number of rollback segments: the number of segment
 
467
specification slots in the transaction system array; rollback segment
 
468
id must fit in one byte, therefore 256; each slot is currently 8 bytes
 
469
in size */
 
470
#define TRX_SYS_N_RSEGS         256
449
471
 
450
472
/** Maximum length of MySQL binlog file name, in bytes.
451
473
@see trx_sys_mysql_master_log_name
462
484
#define TRX_SYS_MYSQL_MASTER_LOG_INFO   (UNIV_PAGE_SIZE - 2000)
463
485
 
464
486
/** The offset of the MySQL binlog offset info in the trx system header */
465
 
#define TRX_SYS_DRIZZLE_LOG_INFO        (UNIV_PAGE_SIZE - 1000)
466
 
#define TRX_SYS_DRIZZLE_MAX_COMMIT_ID   8       /*!< the maximum commit id
467
 
                                                assigned in the system */
468
 
#define TRX_SYS_DRIZZLE_LOG_NAME        12      /*!< Unused */
 
487
#define TRX_SYS_MYSQL_LOG_INFO          (UNIV_PAGE_SIZE - 1000)
 
488
#define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD   0       /*!< magic number which is
 
489
                                                TRX_SYS_MYSQL_LOG_MAGIC_N
 
490
                                                if we have valid data in the
 
491
                                                MySQL binlog info */
 
492
#define TRX_SYS_MYSQL_LOG_OFFSET_HIGH   4       /*!< high 4 bytes of the offset
 
493
                                                within that file */
 
494
#define TRX_SYS_MYSQL_LOG_OFFSET_LOW    8       /*!< low 4 bytes of the offset
 
495
                                                within that file */
 
496
#define TRX_SYS_MYSQL_LOG_NAME          12      /*!< MySQL log file name */
469
497
 
 
498
#ifndef UNIV_HOTBACKUP
470
499
/** Doublewrite buffer */
471
500
/* @{ */
472
501
/** The offset of the doublewrite buffer header on the trx system header page */
518
547
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE  FSP_EXTENT_SIZE
519
548
/* @} */
520
549
 
521
 
#ifndef UNIV_HOTBACKUP
522
550
/** File format tag */
523
551
/* @{ */
524
552
/** The offset of the file format tag on the trx system header page
525
553
(TRX_SYS_PAGE_NO of TRX_SYS_SPACE) */
526
554
#define TRX_SYS_FILE_FORMAT_TAG         (UNIV_PAGE_SIZE - 16)
527
555
 
528
 
/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid. The file format
 
556
/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid.  The file format
529
557
identifier is added to this constant. */
530
558
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW     3645922177UL
531
559
/** Contents of TRX_SYS_FILE_FORMAT_TAG+4 when valid */
532
560
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH    2745987765UL
533
 
/** Contents of TRX_SYS_FILE_FORMAT_TAG when valid. The file format
534
 
identifier is added to this 64-bit constant. */
535
 
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N                                 \
536
 
        ((ib_uint64_t) TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH << 32       \
537
 
         | TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW)
538
561
/* @} */
539
562
 
540
563
/** Doublewrite control struct */
563
586
        trx_id_t        max_trx_id;     /*!< The smallest number not yet
564
587
                                        assigned as a transaction id or
565
588
                                        transaction number */
566
 
 
567
589
        UT_LIST_BASE_NODE_T(trx_t) trx_list;
568
590
                                        /*!< List of active and committed in
569
591
                                        memory transactions, sorted on trx id,