mariadb/storage/maria/tablockman.h
unknown 7412f0fa0c After merge fixes
Removed compiler warnings
Fixed clashing function name in maria
Disable maria tests from MySQL level for now


BitKeeper/deleted/.del-ha_maria.cc:
  Rename: libmysqld/ha_maria.cc -> BitKeeper/deleted/.del-ha_maria.cc
BitKeeper/etc/ignore:
  added libmysqld/ha_maria.cc
  ---
  added storage/maria/unittest/maria_control unittest/maria_control
  ---
  added *.Tpo
  ---
  added unittest/page_cache_test_file_1
  ---
  added unittest/pagecache_debug.log
  ---
  added unittest/mysys/mf_pagecache_consist_1k-t-big unittest/mysys/mf_pagecache_consist_1kHC-t-big unittest/mysys/mf_pagecache_consist_1kRD-t-big unittest/mysys/mf_pagecache_consist_1kWR-t-big unittest/mysys/mf_pagecache_consist_64k-t-big unittest/mysys/mf_pagecache_consist_64kHC-t-big unittest/mysys/mf_pagecache_consist_64kRD-t-big unittest/mysys/mf_pagecache_consist_64kWR-t-big
  ---
  added unittest/mysys/mf_pagecache_single_64k-t-big
Makefile.am:
  Don't run 'test-unit' by default (takes too long time)
client/mysqldump.c:
  Fixed compiler warning
include/lf.h:
  Remove compiler warnings about not used require_pins constant
include/pagecache.h:
  LSN should be of type ulonglong
  (This fixes some compiler warnings)
mysql-test/r/events_logs_tests.result:
  Make test predictable
mysql-test/r/view.result:
  Make test results predictable
mysql-test/t/disabled.def:
  Disable maria tests for a while
mysql-test/t/events_logs_tests.test:
  Make test predictable
mysql-test/t/view.test:
  Make test results predictable
mysys/lf_alloc-pin.c:
  #warning ->QQ
mysys/lf_hash.c:
  #warning ->QQ
  Removed compiler warnings
mysys/mf_pagecache.c:
  Removed compiler warnings
mysys/my_rename.c:
  Removed compiler warnings
plugin/daemon_example/daemon_example.c:
  Remove compiler warning
sql/ha_ndbcluster.cc:
  Remove compiler warning
sql/udf_example.c:
  Remove compiler warning
storage/maria/lockman.c:
  Changed #warnings to QQ comment
  Removed compiler warnings
storage/maria/ma_blockrec.c:
  Removed compiler warnings
storage/maria/ma_check.c:
  After merge fixes
storage/maria/ma_key.c:
  After merge fixes
storage/maria/ma_packrec.c:
  After merge fixes
storage/maria/ma_rkey.c:
  After merge fixes
storage/maria/ma_sort.c:
  After merge fixes
storage/maria/ma_sp_defs.h:
  Rename clashing function name
storage/maria/ma_sp_key.c:
  Rename clashing function name
storage/maria/ma_test_all.res:
  New test results
storage/maria/ma_unique.c:
  Fixed compiler warning
storage/maria/tablockman.c:
  #warning -> QQ
storage/maria/tablockman.h:
  #warning -> QQ
storage/maria/trnman.c:
  #warning -> QQ
storage/maria/unittest/lockman2-t.c:
  Removed compiler warnings
storage/maria/unittest/ma_control_file-t.c:
  Removed warning for 'maria_control' file not found
storage/maria/unittest/trnman-t.c:
  Removed compiler warnings
storage/ndb/src/mgmapi/mgmapi.cpp:
  Remove compiler warnings
unittest/mysys/mf_pagecache_consist.c:
  Removed compiler warnings
unittest/mysys/my_atomic-t.c:
  Removed compiler warnings
2007-01-26 13:32:02 +02:00

88 lines
3.3 KiB
C

/* Copyright (C) 2006 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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _tablockman_h
#define _tablockman_h
/*
Lock levels:
^^^^^^^^^^^
N - "no lock", not a lock, used sometimes internally to simplify the code
S - Shared
X - eXclusive
IS - Intention Shared
IX - Intention eXclusive
SIX - Shared + Intention eXclusive
LS - Loose Shared
LX - Loose eXclusive
SLX - Shared + Loose eXclusive
LSIX - Loose Shared + Intention eXclusive
*/
#ifndef _lockman_h
/* QQ: TODO remove N-locks */
enum lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST };
enum lockman_getlock_result {
NO_MEMORY_FOR_LOCK=1, DEADLOCK, LOCK_TIMEOUT,
GOT_THE_LOCK,
GOT_THE_LOCK_NEED_TO_LOCK_A_SUBRESOURCE,
GOT_THE_LOCK_NEED_TO_INSTANT_LOCK_A_SUBRESOURCE
};
#endif
#define LOCK_TYPES (LOCK_TYPE_LAST-1)
typedef struct st_table_lock TABLE_LOCK;
typedef struct st_table_lock_owner {
TABLE_LOCK *active_locks; /* list of active locks */
TABLE_LOCK *waiting_lock; /* waiting lock (one lock only) */
struct st_table_lock_owner *waiting_for; /* transaction we're waiting for */
pthread_cond_t *cond; /* transactions waiting for us, wait on 'cond' */
pthread_mutex_t *mutex; /* mutex is required to use 'cond' */
uint16 loid, waiting_for_loid; /* Lock Owner IDentifier */
} TABLE_LOCK_OWNER;
typedef struct st_locked_table {
pthread_mutex_t mutex; /* mutex for everything below */
HASH latest_locks; /* latest locks in a hash */
TABLE_LOCK *active_locks[LOCK_TYPES]; /* dl-list of locks per type */
TABLE_LOCK *wait_queue_in, *wait_queue_out; /* wait deque (double-end queue)*/
} LOCKED_TABLE;
typedef TABLE_LOCK_OWNER *loid_to_tlo_func(uint16);
typedef struct {
pthread_mutex_t pool_mutex;
TABLE_LOCK *pool; /* lifo pool of free locks */
uint lock_timeout; /* lock timeout in milliseconds */
loid_to_tlo_func *loid_to_tlo; /* for mapping loid to TABLE_LOCK_OWNER */
} TABLOCKMAN;
void tablockman_init(TABLOCKMAN *, loid_to_tlo_func *, uint);
void tablockman_destroy(TABLOCKMAN *);
enum lockman_getlock_result tablockman_getlock(TABLOCKMAN *, TABLE_LOCK_OWNER *,
LOCKED_TABLE *, enum lock_type);
void tablockman_release_locks(TABLOCKMAN *, TABLE_LOCK_OWNER *);
void tablockman_init_locked_table(LOCKED_TABLE *, int);
void tablockman_destroy_locked_table(LOCKED_TABLE *);
#ifdef EXTRA_DEBUG
void tablockman_print_tlo(TABLE_LOCK_OWNER *);
#endif
#endif