diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-05-29 20:13:56 +0300 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-05-29 20:13:56 +0300 |
commit | 8f39541e7d8ba812d1198af5d4179ba44d6693fa (patch) | |
tree | fb321fb70d8c6fa75698d9bedf4218927421686e /include/lf.h | |
parent | 486fd0a22ae11ed6bc1f425e7ab7fcdb03679b20 (diff) | |
download | mariadb-git-8f39541e7d8ba812d1198af5d4179ba44d6693fa.tar.gz |
This patch is a collection of patches from from Sanja, Sergei and Monty.
Added logging and pinning of pages to block format.
Integration of transaction manager, log handler.
Better page cache intergration
Split trnman.h into two files, so that we don't have to include my_atomic.h into C++ programs.
Renaming of structures, more comments, more debugging etc.
Fixed problem with small head block + long varchar.
Added extra argument to delete_record() and update_record() (needed for UNDO logging)
Small changes to interface of pagecache and log handler.
Change initialization of log_record_type_descriptors to not be depending on enum order.
Use array of LEX_STRING's to send data to log handler
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
include/lf.h:
Interface fixes
Rename of structures
(Patch from Sergei via Sanja)
include/my_atomic.h:
More comments
include/my_global.h:
Added MY_ERRPTR
include/pagecache.h:
Added undo LSN when unlocking pages
mysql-test/r/maria.result:
Updated results
mysql-test/t/maria.test:
Added autocommit around lock tables
(Patch from Sanja)
mysys/lf_alloc-pin.c:
Post-review fixes, simple optimizations
More comments
Struct slot renames
Check amount of memory on stack
(Patch from Sergei)
mysys/lf_dynarray.c:
More comments
mysys/lf_hash.c:
More comments
After review fixes
(Patch from Sergei)
storage/maria/ha_maria.cc:
Split trnman.h into two files, so that we don't have to include my_atomic.h into the .cc program.
(Temporary fix to avoid bug in gcc)
Move out all deferencing of the transaction structure.
Transaction manager integrated (Patch from Sergei)
storage/maria/ha_maria.h:
Added prototype for start_stmt()
storage/maria/lockman.c:
Function call rename
storage/maria/ma_bitmap.c:
Mark deleted pages free from page cache
storage/maria/ma_blockrec.c:
Offset -> rownr
More debugging
Fixed problem with small head block + long varchar
Added logging of changed pages
Added logging of undo (Including only loggging of changed fields in case of update)
Added pinning/unpinning of all changed pages
More comments
Added free_full_pages() as the same code was used in several places.
fill_rows_parts() renamed as fill_insert_undo_parts()
offset -> rownr
Added some optimization of not transactional tables
_ma_update_block_record() has new parameter, as we need original row to do efficent undo for update
storage/maria/ma_blockrec.h:
Added ROW_EXTENTS_ON_STACK
Changed prototype for update and delete of row
storage/maria/ma_check.c:
Added original row to delete_record() call
storage/maria/ma_control_file.h:
Added ifdefs for C++
storage/maria/ma_delete.c:
Added original row to delete_record() call
(Needed for efficent undo logging)
storage/maria/ma_dynrec.c:
Added extra argument to delete_record() and update_record()
Removed not used variable
storage/maria/ma_init.c:
Initialize log handler
storage/maria/ma_loghandler.c:
Removed not used variable
Change initialization of log_record_type_descriptors to not be depending on enum order
Use array of LEX_STRING's to send data to log handler
storage/maria/ma_loghandler.h:
New defines
Use array of LEX_STRING's to send data to log handler
storage/maria/ma_open.c:
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
Store in MARIA_SHARE->page_type if pages will have up to date LSN's
storage/maria/ma_pagecache.c:
Don't decrease number of readers when using pagecache_write()/pagecache_read()
In pagecache_write() decrement request count if page was left pinned
Added pagecache_delete_pages()
Removed some casts
Make trace output consistent with rest of code
Simplify calling of DBUG_ASSERT(0)
Only update LSN if the LSN is bigger than what's already on the page
Added LSN parameter pagecache_unpin_page(), pagecache_unpin(), and pagecache_unlock()
(Part of patch from Sanja)
storage/maria/ma_static.c:
Added 'dummy' transaction option to MARIA_INFO so that we can always assume 'trn' exists.
Added default page cache
storage/maria/ma_statrec.c:
Added extra argument to delete_record() and update_record()
storage/maria/ma_test1.c:
Added option -T for transactions
storage/maria/ma_test2.c:
Added option -T for transactions
storage/maria/ma_test_all.sh:
Test with transactions
storage/maria/ma_update.c:
Changed prototype for update of row
storage/maria/maria_def.h:
Changed prototype for update & delete of row as block records need to access the old row
Store in MARIA_SHARE->page_type if pages will have up to date LSN's
Added MARIA_MAX_TREE_LEVELS to allow us to calculate the number of possible pinned pages we may need.
Removed not used 'empty_bits_buffer'
Added pointer to transaction object
Added array for pinned pages
Added log_row_parts array for logging of field data.
Added MARIA_PINNED_PAGE to store pinned pages
storage/maria/trnman.c:
Added accessor functions to transaction object
Added missing DBUG_RETURN()
More debugging
More comments
Changed // comment of code to #ifdef NOT_USED
Transaction manager integrated.
Post review fixes
Part of patch originally from Sergei
storage/maria/trnman.h:
Split trnman.h into two files, so that we don't have to include my_atomic.h into the .cc program.
(Temporary fix to avoid bug in gcc)
storage/maria/unittest/ma_pagecache_single.c:
Added missing argument
Added SKIP_BIG_TESTS
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
Test logging with new LEX_STRING parameter
(Patch from Sanja)
storage/maria/unittest/trnman-t.c:
Stack overflow detection
(Patch from Sergei)
unittest/unit.pl:
Command-line options --big and --verbose
(Patch from Sergei)
unittest/mytap/tap.c:
Detect --big
(Patch from Sergei)
unittest/mytap/tap.h:
Skip_big_tests and SKIP_BIG_TESTS
(Patch from Sergei)
storage/maria/trnman_public.h:
New BitKeeper file ``storage/maria/trnman_public.h''
Diffstat (limited to 'include/lf.h')
-rw-r--r-- | include/lf.h | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/include/lf.h b/include/lf.h index 39a47e6568a..4712f9c4862 100644 --- a/include/lf.h +++ b/include/lf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 MySQL AB +/* Copyright (C) 2007 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -96,26 +96,28 @@ nolock_wrap(lf_dynarray_iterate, int, #define LF_PINBOX_PINS 4 #define LF_PURGATORY_SIZE 10 -typedef void lf_pinbox_free_func(void *, void *); +typedef void lf_pinbox_free_func(void *, void *, void*); typedef struct { - LF_DYNARRAY pinstack; + LF_DYNARRAY pinarray; lf_pinbox_free_func *free_func; void *free_func_arg; uint free_ptr_offset; uint32 volatile pinstack_top_ver; /* this is a versioned pointer */ - uint32 volatile pins_in_stack; /* number of elements in array */ + uint32 volatile pins_in_array; /* number of elements in array */ } LF_PINBOX; typedef struct { void * volatile pin[LF_PINBOX_PINS]; LF_PINBOX *pinbox; + void *stack_ends_here; void *purgatory; uint32 purgatory_count; uint32 volatile link; /* we want sizeof(LF_PINS) to be 128 to avoid false sharing */ char pad[128-sizeof(uint32)*2 -sizeof(LF_PINBOX *) + -sizeof(void*) -sizeof(void *)*(LF_PINBOX_PINS+1)]; } LF_PINS; @@ -124,9 +126,9 @@ typedef struct { (e.g. lf_hash). */ #define lf_rwlock_by_pins(PINS) \ - my_atomic_rwlock_wrlock(&(PINS)->pinbox->pinstack.lock) + my_atomic_rwlock_wrlock(&(PINS)->pinbox->pinarray.lock) #define lf_rwunlock_by_pins(PINS) \ - my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinstack.lock) + my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinarray.lock) /* compile-time assert, to require "no less than N" pins @@ -135,9 +137,9 @@ typedef struct { */ #if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG) #define LF_REQUIRE_PINS(N) \ - static const char require_pins[LF_PINBOX_PINS-N] __attribute__ ((unused)); \ - static const int LF_NUM_PINS_IN_THIS_FILE= N - + static const char require_pins[LF_PINBOX_PINS-N] \ + __attribute__ ((unused)); \ + static const int LF_NUM_PINS_IN_THIS_FILE= N; #define _lf_pin(PINS, PIN, ADDR) \ ( \ assert(PIN < LF_NUM_PINS_IN_THIS_FILE), \ @@ -164,17 +166,17 @@ void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset, void lf_pinbox_destroy(LF_PINBOX *pinbox); lock_wrap(lf_pinbox_get_pins, LF_PINS *, - (LF_PINBOX *pinbox), - (pinbox), - &pinbox->pinstack.lock) + (LF_PINBOX *pinbox, void *stack_end), + (pinbox, stack_end), + &pinbox->pinarray.lock); lock_wrap_void(lf_pinbox_put_pins, (LF_PINS *pins), (pins), - &pins->pinbox->pinstack.lock) + &pins->pinbox->pinarray.lock); lock_wrap_void(lf_pinbox_free, (LF_PINS *pins, void *addr), (pins, addr), - &pins->pinbox->pinstack.lock) + &pins->pinbox->pinarray.lock); /* memory allocator, lf_alloc-pin.c @@ -193,23 +195,23 @@ typedef struct st_lf_allocator { void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset); void lf_alloc_destroy(LF_ALLOCATOR *allocator); -uint lf_alloc_in_pool(LF_ALLOCATOR *allocator); +uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); /* shortcut macros to access underlying pinbox functions from an LF_ALLOCATOR see _lf_pinbox_get_pins() and _lf_pinbox_put_pins() */ -#define _lf_alloc_free(PINS, PTR) _lf_pinbox_free((PINS), (PTR)) -#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR)) -#define _lf_alloc_get_pins(ALLOC) _lf_pinbox_get_pins(&(ALLOC)->pinbox) -#define lf_alloc_get_pins(ALLOC) lf_pinbox_get_pins(&(ALLOC)->pinbox) -#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) -#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) -#define lf_alloc_real_free(ALLOC, ADDR) my_free((gptr)(ADDR), MYF(0)) +#define _lf_alloc_free(PINS, PTR) _lf_pinbox_free((PINS), (PTR)) +#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR)) +#define _lf_alloc_get_pins(A, ST) _lf_pinbox_get_pins(&(A)->pinbox, (ST)) +#define lf_alloc_get_pins(A, ST) lf_pinbox_get_pins(&(A)->pinbox, (ST)) +#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) +#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) +#define lf_alloc_direct_free(ALLOC, ADDR) my_free((gptr)(ADDR), MYF(0)) lock_wrap(lf_alloc_new, void *, (LF_PINS *pins), (pins), - &pins->pinbox->pinstack.lock) + &pins->pinbox->pinarray.lock); /* extendible hash, lf_hash.c @@ -240,11 +242,11 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); shortcut macros to access underlying pinbox functions from an LF_HASH see _lf_pinbox_get_pins() and _lf_pinbox_put_pins() */ -#define _lf_hash_get_pins(HASH) _lf_alloc_get_pins(&(HASH)->alloc) -#define lf_hash_get_pins(HASH) lf_alloc_get_pins(&(HASH)->alloc) -#define _lf_hash_put_pins(PINS) _lf_pinbox_put_pins(PINS) -#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS) - +#define _lf_hash_get_pins(HASH, ST) _lf_alloc_get_pins(&(HASH)->alloc, (ST)) +#define lf_hash_get_pins(HASH, ST) lf_alloc_get_pins(&(HASH)->alloc, (ST)) +#define _lf_hash_put_pins(PINS) _lf_pinbox_put_pins(PINS) +#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS) +#define lf_hash_search_unpin(PINS) lf_unpin((PINS), 2) /* cleanup */ |