Commit b8ed6799 authored by Paul McCullagh's avatar Paul McCullagh

Updated PBXT to version 1.0.08 RC2

parent 915a624c
This diff is collapsed.
PBXT Release Notes
==================
------- 1.0.08 RC - Not yet released
------- 1.0.08 RC2 - 2009-06-30
RN251: A Windows-specific test update, also removed false assertion that failed on Windows.
RN250: Fixed a bug that caused recovery to fail when the transaction log ID exceeded 255. The problem was a checksum failed in the log record.
RN249: Fixed bug #313176: Test case timeout. This happened because record cache pages where not propoerly freed and as soon as cache filled up the performacne degraded.
RN248: PBXT now compiles and runs with MySQL 5.1.35. All tests pass.
RN247: Fixed bug #369086: Incosistent/Incorrect Truncate behavior
RN246: Fixed bug #378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
RN245: Fixed bug #379315: Inconsistent behavior of DELETE IGNORE and FK constraint.
RN244: Fixed a recovery problem: during the recovery of "record modified" action the table was updated before the old index entries were removed; then the xres_remove_index_entries was supplied the new record which lead to incorrect index update.
RN243: Fixed a bug that caused a recovery failure if partitioned pbxt tables where present. This happended because the recovery used a MySQL function to open tables and the PBXT handler was not yet registered
RN242: Fixed a bug that caused a deadlock if pbxt initialization failed. This happened because pbxt ceanup was done from pbxt_init() with PLUGIN_lock being held by MySQL which lead to a deadlock in the freeer thread
RN241: Fixed a heap corruption bug (writing to a freed memory location). It happened only when memory mapped files were used leading to heap inconsistency and program crash or termination by heap checker. Likely to happen right after or during DROP TABLE but possible in other cases too.
RN240: Load the record cache on read when no using memory mapped files.
RN239: Added PBXT variable pbxt_max_threads. This is the maximum number of threads that can be created PBXT. By default this value is set to 0 which means the number of threads is derived from the MySQL variable max_connections. The value used is max_connections+7. Under Drizzle the default value is 500.
RN238: Added an option to wait for the sweeper to clean up old transactions on a particular connection. This prevents the sweeper from getting too far behind.
RN237: Added an option to lazy delete fixed length index entries. This means the index entries are just marked for deletion, instead of removing the items from the index page. This has the advantage that an exclusive lock is not always required for deletion.
RN236: Fixed bug #349177: a bug in configure.in script.
RN235: Fixed bug 349176: a compiler warning.
RN234: Completed Drizzle integration. All Drizzle tests now run with PBXT.
RN233: Fixed bugs which occur when PBXT is used together with PBMS (BLOB Streaming engine).
......
This diff is collapsed.
......@@ -45,8 +45,46 @@ struct XTIdxReadBuffer;
#define IDX_CAC_BLOCK_CLEAN 1
#define IDX_CAC_BLOCK_DIRTY 2
typedef enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF };
typedef enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
#ifdef XT_NO_ATOMICS
#define XT_IPAGE_USE_PTHREAD_RW
#else
//#define XT_IPAGE_USE_ATOMIC_RW
#define XT_IPAGE_USE_SPINXSLOCK
//#define XT_IPAGE_USE_SKEW_RW
#endif
#ifdef XT_IPAGE_USE_ATOMIC_RW
#define XT_IPAGE_LOCK_TYPE XTAtomicRWLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_atomicrwlock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_atomicrwlock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_atomicrwlock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
#elif defined(XT_IPAGE_USE_PTHREAD_RW)
#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
#define XT_IPAGE_UNLOCK(i, x) xt_unlock_rwlock_ns(i)
#elif defined(XT_IPAGE_USE_SPINXSLOCK)
#define XT_IPAGE_LOCK_TYPE XTSpinXSLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_spinxslock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_spinxslock_unlock(i, x)
#else // XT_IPAGE_USE_SKEW_RW
#define XT_IPAGE_LOCK_TYPE XTSkewRWLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_skewrwlock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_skewrwlock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_skewrwlock_unlock(i, x)
#endif
enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF, XT_XLOCK_DEL_LEAF };
enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
/* A block is X locked if it is being changed or freed.
* A block is S locked if it is being read.
......@@ -64,10 +102,11 @@ typedef struct XTIndBlock {
struct XTIndBlock *cb_mr_used; /* More recently used blocks. */
struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */
/* Protected by cb_lock: */
XTAtomicRWLockRec cb_lock;
XT_IPAGE_LOCK_TYPE cb_lock;
xtWord1 cb_state; /* Block status. */
xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */
xtWord2 cp_flush_seq;
xtWord2 cp_del_count; /* Number of deleted entries. */
#ifdef XT_USE_DIRECT_IO_ON_INDEX
xtWord1 *cb_data;
#else
......@@ -76,16 +115,18 @@ typedef struct XTIndBlock {
} XTIndBlockRec, *XTIndBlockPtr;
typedef struct XTIndReference {
XTPageUnlockType ir_ulock;
xtBool ir_xlock; /* Set to TRUE if the cache block is X locked. */
xtBool ir_updated; /* Set to TRUE if the cache block is updated. */
XTIndBlockPtr ir_block;
XTIdxBranchDPtr ir_branch;
} XTIndReferenceRec, *XTIndReferencePtr;
typedef struct XTIndFreeBlock {
XTDiskValue1 if_zero1_1; /* Must be set to zero. */
XTDiskValue1 if_zero2_1; /* Must be set to zero. */
XTDiskValue1 if_status_1;
XTDiskValue1 if_unused1_1;
XTDiskValue2 if_unused2_2;
XTDiskValue4 if_unused3_4;
XTDiskValue4 if_unused2_4;
XTDiskValue8 if_next_block_8;
} XTIndFreeBlockRec, *XTIndFreeBlockPtr;
......@@ -116,14 +157,13 @@ xtInt8 xt_ind_get_size();
xtBool xt_ind_write(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_write_cache(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_clean(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset);
xtBool xt_ind_read_bytes(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_read_bytes(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
void xt_ind_check_cache(XTIndexPtr ind);
xtBool xt_ind_reserve(struct XTOpenTable *ot, u_int count, XTIdxBranchDPtr not_this);
void xt_ind_free_reserved(struct XTOpenTable *ot);
void xt_ind_unreserve(struct XTOpenTable *ot);
void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
xtBool xt_ind_fetch(struct XTOpenTable *ot, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
xtBool xt_ind_fetch(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
xtBool xt_ind_release(struct XTOpenTable *ot, XTIndexPtr ind, XTPageUnlockType utype, XTIndReferencePtr iref);
void xt_ind_lock_handle(XTIndHandlePtr handle);
......
......@@ -29,7 +29,7 @@
#include "ccutils_xt.h"
#include "bsearch_xt.h"
static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
{
XTObject *obj_ptr = (XTObject *) b;
......
......@@ -23,6 +23,10 @@
#include "xt_config.h"
#ifdef DRIZZLED
#include <bitset>
#endif
#include <string.h>
#include <stdio.h>
......@@ -240,7 +244,7 @@ static void db_hash_free(XTThreadPtr self, void *data)
xt_heap_release(self, (XTDatabaseHPtr) data);
}
static int db_cmp_db_id(struct XTThread XT_UNUSED(*self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
static int db_cmp_db_id(struct XTThread *XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
{
xtDatabaseID db_id = *((xtDatabaseID *) a);
XTDatabaseHPtr *db_ptr = (XTDatabaseHPtr *) b;
......@@ -346,7 +350,7 @@ static void db_finalize(XTThreadPtr self, void *x)
}
}
static void db_onrelease(XTThreadPtr self, void XT_UNUSED(*x))
static void db_onrelease(XTThreadPtr self, void *XT_UNUSED(x))
{
/* Signal threads waiting for exclusive use of the database: */
if (xt_db_open_databases) // The database may already be closed.
......@@ -612,7 +616,7 @@ xtPublic void xt_drop_database(XTThreadPtr self, XTDatabaseHPtr db)
xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool multi_path)
{
XTDatabaseHPtr db;
/* We cannot get a database, without unusing the current
* first. The reason is that the restart process will
* partially set the current database!
......@@ -621,7 +625,7 @@ xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool multi_path)
db = xt_get_database(self, path, multi_path);
pushr_(xt_heap_release, db);
xt_use_database(self, db, XT_FOR_USER);
freer_(); // xt_heap_release(self, db);
freer_(); // xt_heap_release(self, db);
}
/* This function can only be called if you do not already have a database in
......@@ -638,6 +642,12 @@ xtPublic void xt_use_database(XTThreadPtr self, XTDatabaseHPtr db, int what_for)
xt_heap_reference(self, db);
self->st_database = db;
#ifdef XT_WAIT_FOR_CLEANUP
self->st_last_xact = 0;
for (int i=0; i<XT_MAX_XACT_BEHIND; i++) {
self->st_prev_xact[i] = db->db_xn_curr_id;
}
#endif
xt_xn_init_thread(self, what_for);
}
......@@ -1117,15 +1127,18 @@ xtPublic void xt_db_return_table_to_pool_ns(XTOpenTablePtr ot)
XTDatabaseHPtr db = ot->ot_table->tab_db;
xtBool flush_table = TRUE;
/* No open table returned to the pool should still
* have a cache handle!
*/
ASSERT_NS(!ot->ot_ind_rhandle);
xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
if (!(table_pool = db_get_open_table_pool(db, ot->ot_table->tab_id)))
goto failed;
if (table_pool->opt_locked && !table_pool->opt_flushing) {
table_pool->opt_total_open--;
/* Table will be closed below: */
if (table_pool->opt_total_open > 0)
if (table_pool->opt_total_open > 1)
flush_table = FALSE;
}
else {
......@@ -1151,14 +1164,21 @@ xtPublic void xt_db_return_table_to_pool_ns(XTOpenTablePtr ot)
ot = NULL;
}
if (ot) {
xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
xt_close_table(ot, flush_table, FALSE);
/* assume that table_pool cannot be invalidated in between as we have table_pool->opt_total_open > 0 */
xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
table_pool->opt_total_open--;
}
db_free_open_table_pool(NULL, table_pool);
if (!xt_broadcast_cond_ns(&db->db_ot_pool.opt_cond))
goto failed;
xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
if (ot)
xt_close_table(ot, flush_table, FALSE);
return;
failed:
......
This diff is collapsed.
......@@ -137,6 +137,7 @@ class XTDDColumnRef : public XTObject {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTObject::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self);
};
......@@ -156,6 +157,7 @@ class XTDDConstraint : public XTObject {
co_ind_name(NULL) {
}
virtual void init(XTThreadPtr self) { XTObject::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self) {
if (co_name)
......@@ -198,6 +200,7 @@ class XTDDIndex : public XTDDConstraint {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTDDConstraint::init(self); };
virtual void init(XTThreadPtr self, XTObject *obj);
struct XTIndex *getIndexPtr();
};
......@@ -230,6 +233,7 @@ class XTDDForeignKey : public XTDDIndex {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTDDIndex::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self);
virtual void loadString(XTThreadPtr self, XTStringBufferPtr sb);
......@@ -284,7 +288,7 @@ class XTDDTable : public XTObject {
XTDDIndex *findReferenceIndex(XTDDForeignKey *fk);
bool insertRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
bool checkNoAction(struct XTOpenTable *ot, xtRecordID rec_id);
xtBool checkCanDrop();
xtBool checkCanDrop(xtBool drop_db);
bool deleteRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
void deleteAllRows(XTThreadPtr self);
bool updateRow(struct XTOpenTable *rec_ot, xtWord1 *before, xtWord1 *after);
......
......@@ -301,7 +301,7 @@ static xtBool dl_write_log_header(XTDataLogFilePtr data_log, XTOpenFilePtr of, x
return OK;
}
static void dl_free_seq_read(XTThreadPtr self __attribute__((unused)), XTDataSeqReadPtr seq_read)
static void dl_free_seq_read(XTThreadPtr XT_UNUSED(self), XTDataSeqReadPtr seq_read)
{
seq_read->sl_seq_exit();
}
......@@ -452,7 +452,7 @@ xtBool XTDataLogCache::dls_set_log_state(XTDataLogFilePtr data_log, int state)
return FAILED;
}
static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
{
xtLogID log_id_a = *((xtLogID *) a);
xtLogID log_id_b = *((xtLogID *) b);
......@@ -1149,7 +1149,7 @@ xtBool XTDataLogBuffer::dlb_flush_log(xtBool commit, XTThreadPtr thread)
return OK;
}
xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
{
ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
......@@ -1166,7 +1166,7 @@ xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID log_id __attribute__((unused)
return OK;
}
xtBool XTDataLogBuffer::dlb_append_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
xtBool XTDataLogBuffer::dlb_append_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
{
ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
......@@ -1357,7 +1357,7 @@ xtBool XTDataLogBuffer::dlb_delete_log(xtLogID log_id, xtLogOffset log_offset, s
* Delete all the extended data belonging to a particular
* table.
*/
xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool missing_ok __attribute__((unused)), xtBool have_table_lock)
xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool XT_UNUSED(missing_ok), xtBool have_table_lock)
{
XTOpenTablePtr ot;
xtRecordID page_rec_id, offs_rec_id;
......
......@@ -1282,9 +1282,11 @@ static bool mysql_create_table_no_lock(THD *thd,
#endif // LOCK_OPEN_HACK_REQUIRED
//------------------------------
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys __attribute__((unused)), xtBool skip_existing)
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
{
#ifdef DRIZZLED
drizzled::message::Table table_proto;
static const char *ext = ".dfe";
static const int ext_len = 4;
#else
......@@ -1329,8 +1331,7 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
info->field_flags,
COLUMN_FORMAT_TYPE_FIXED,
NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
NULL /*interval_list*/, info->field_charset,
NULL /*vcol_info*/))
NULL /*interval_list*/, info->field_charset))
#else
if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
info->field_flags,
......@@ -1365,7 +1366,10 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
/* Create an internal temp table */
#ifdef DRIZZLED
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0, false))
table_proto.set_name(name);
table_proto.set_type(drizzled::message::Table::STANDARD);
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
goto error;
#else
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
......
This diff is collapsed.
......@@ -76,13 +76,60 @@ xtBool xt_fs_rename(struct XTThread *self, char *from_path, char *to_path);
#define XT_NULL_FD (-1)
#endif
/* Note, this lock must be re-entrant,
* The only lock that satifies this is
* FILE_MAP_USE_RWMUTEX!
*
* 20.05.2009: This problem should be fixed now with mf_slock_count!
*
* The lock need no longer be re-entrant
*/
#ifdef XT_NO_ATOMICS
#define FILE_MAP_USE_PTHREAD_RW
#else
//#define FILE_MAP_USE_RWMUTEX
//#define FILE_MAP_USE_PTHREAD_RW
//#define IDX_USE_SPINXSLOCK
#define FILE_MAP_USE_XSMUTEX
#endif
#ifdef FILE_MAP_USE_XSMUTEX
#define FILE_MAP_LOCK_TYPE XTXSMutexRec
#define FILE_MAP_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_xsmutex_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_xsmutex_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xsmutex_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_PTHREAD_RW)
#define FILE_MAP_LOCK_TYPE xt_rwlock_type
#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
#define FILE_MAP_UNLOCK(i, o) xt_unlock_rwlock_ns(i)
#elif defined(FILE_MAP_USE_RWMUTEX)
#define FILE_MAP_LOCK_TYPE XTRWMutexRec
#define FILE_MAP_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_rwmutex_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_rwmutex_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_rwmutex_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_rwmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_SPINXSLOCK)
#define FILE_MAP_LOCK_TYPE XTSpinXSLockRec
#define FILE_MAP_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_spinxslock_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_spinxslock_unlock(i, o)
#endif
typedef struct XTFileMemMap {
xtWord1 *mm_start; /* The in-memory start of the map. */
#ifdef XT_WIN
HANDLE mm_mapdes;
#endif
off_t mm_length; /* The length of the file map. */
XTRWMutexRec mm_lock; /* The file map R/W lock. */
FILE_MAP_LOCK_TYPE mm_lock; /* The file map R/W lock. */
size_t mm_grow_size; /* The amount by which the map file is increased. */
} XTFileMemMapRec, *XTFileMemMapPtr;
......@@ -127,6 +174,9 @@ xtBool xt_pwrite_file(XTOpenFilePtr of, off_t offset, size_t size, void *data,
xtBool xt_pread_file(XTOpenFilePtr of, off_t offset, size_t size, size_t min_size, void *data, size_t *red_size, struct XTIOStats *timer, struct XTThread *thread);
xtBool xt_flush_file(XTOpenFilePtr of, struct XTIOStats *timer, struct XTThread *thread);
xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, struct XTIOStats *timer, struct XTThread *thread);
void xt_unlock_file_ptr(XTOpenFilePtr of, xtWord1 *data, struct XTThread *thread);
typedef struct XTOpenDir {
char *od_path;
#ifdef XT_WIN
......@@ -134,8 +184,14 @@ typedef struct XTOpenDir {
WIN32_FIND_DATA od_data;
#else
char *od_filter;
struct dirent od_entry;
DIR *od_dir;
/* WARNING: Solaris requires od_entry.d_name member to have size at least as returned
* by pathconf() function on per-directory basis. This makes it impossible to statically
* pre-set the size. So xt_dir_open on Solaris dynamically allocates space as needed.
*
* This also means that the od_entry member should always be last in the XTOpenDir structure.
*/
struct dirent od_entry;
#endif
} XTOpenDirRec, *XTOpenDirPtr;
......@@ -147,6 +203,7 @@ xtBool xt_dir_is_file(struct XTThread *self, XTOpenDirPtr od);
off_t xt_dir_file_size(struct XTThread *self, XTOpenDirPtr od);
typedef struct XTMapFile : public XTFileRef {
u_int mf_slock_count;
XTFileMemMapPtr mf_memmap;
} XTMapFileRec, *XTMapFilePtr;
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
#include <drizzled/handler.h>
#include <drizzled/handlerton.h>
#include <drizzled/plugin/storage_engine.h>
#include <mysys/thr_lock.h>
#else
#include "mysql_priv.h"
......@@ -51,6 +51,25 @@
class ha_pbxt;
#ifdef DRIZZLED
class PBXTStorageEngine : public StorageEngine {
public:
PBXTStorageEngine(std::string name_arg)
: StorageEngine(name_arg, HTON_NO_FLAGS) {}
/* override */ int close_connection(Session *);
/* override */ int commit(Session *, bool);
/* override */ int rollback(Session *, bool);
/* override */ handler *create(TABLE_SHARE *, MEM_ROOT *);
/* override */ void drop_database(char *);
/* override */ bool show_status(Session *, stat_print_fn *, enum ha_stat_type);
};
typedef PBXTStorageEngine handlerton;
#endif
extern handlerton *pbxt_hton;
/*
......
......@@ -75,7 +75,7 @@ const char **ha_xtsys::bas_ext() const
return ha_pbms_exts;
}
int ha_xtsys::open(const char *table_path, int mode __attribute__((unused)), uint test_if_locked __attribute__((unused)))
int ha_xtsys::open(const char *table_path, int XT_UNUSED(mode), uint XT_UNUSED(test_if_locked))
{
THD *thd = current_thd;
XTExceptionRec e;
......@@ -141,7 +141,7 @@ int ha_xtsys::close(void)
return err;
}
int ha_xtsys::rnd_init(bool scan __attribute__((unused)))
int ha_xtsys::rnd_init(bool XT_UNUSED(scan))
{
int err = 0;
......@@ -185,7 +185,7 @@ int ha_xtsys::rnd_pos(byte * buf, byte *pos)
return err;
}
int ha_xtsys::info(uint flag __attribute__((unused)))
int ha_xtsys::info(uint XT_UNUSED(flag))
{
return 0;
}
......@@ -211,7 +211,7 @@ int ha_xtsys::external_lock(THD *thd, int lock_type)
return err;
}
THR_LOCK_DATA **ha_xtsys::store_lock(THD *thd __attribute__((unused)), THR_LOCK_DATA **to, enum thr_lock_type lock_type)
THR_LOCK_DATA **ha_xtsys::store_lock(THD *XT_UNUSED(thd), THR_LOCK_DATA **to, enum thr_lock_type lock_type)
{
if (lock_type != TL_IGNORE && ha_lock.type == TL_UNLOCK)
ha_lock.type = lock_type;
......@@ -220,13 +220,13 @@ THR_LOCK_DATA **ha_xtsys::store_lock(THD *thd __attribute__((unused)), THR_LOCK_
}
/* Note: ha_pbxt::delete_system_table is called instead. */
int ha_xtsys::delete_table(const char *table_path __attribute__((unused)))
int ha_xtsys::delete_table(const char *XT_UNUSED(table_path))
{
/* Should never be called */
return 0;
}
int ha_xtsys::create(const char *name __attribute__((unused)), TABLE *table_arg __attribute__((unused)), HA_CREATE_INFO *create_info __attribute__((unused)))
int ha_xtsys::create(const char *XT_UNUSED(name), TABLE *XT_UNUSED(table_arg), HA_CREATE_INFO *XT_UNUSED(create_info))
{
/* Allow the table to be created.
* This is required after a dump is restored.
......@@ -234,7 +234,7 @@ int ha_xtsys::create(const char *name __attribute__((unused)), TABLE *table_arg
return 0;
}
bool ha_xtsys::get_error_message(int error __attribute__((unused)), String *buf)
bool ha_xtsys::get_error_message(int XT_UNUSED(error), String *buf)
{
THD *thd = current_thd;
XTExceptionRec e;
......
......@@ -59,7 +59,7 @@ class ha_xtsys: public handler
const char *table_type() const { return "PBXT"; }
const char *index_type(uint inx __attribute__((unused))) {
const char *index_type(uint XT_UNUSED(inx)) {
return "NONE";
}
......@@ -69,7 +69,7 @@ class ha_xtsys: public handler
return HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
}
MX_ULONG_T index_flags(uint inx __attribute__((unused)), uint part __attribute__((unused)), bool all_parts __attribute__((unused))) const {
MX_ULONG_T index_flags(uint XT_UNUSED(inx), uint XT_UNUSED(part), bool XT_UNUSED(all_parts)) const {
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return 512; }
......
......@@ -115,7 +115,7 @@ xtPublic void xt_ht_put(XTThreadPtr self, XTHashTabPtr ht, void *data)
popr_();
}
xtPublic void *xt_ht_get(XTThreadPtr self __attribute__((unused)), XTHashTabPtr ht, void *key)
xtPublic void *xt_ht_get(XTThreadPtr XT_UNUSED(self), XTHashTabPtr ht, void *key)
{
XTHashItemPtr item;
xtHashValue h;
......@@ -239,14 +239,14 @@ xtPublic void xt_ht_signal(XTThreadPtr self, XTHashTabPtr ht)
xt_signal_cond(self, ht->ht_cond);
}
xtPublic void xt_ht_enum(struct XTThread *self __attribute__((unused)), XTHashTabPtr ht, XTHashEnumPtr en)
xtPublic void xt_ht_enum(struct XTThread *XT_UNUSED(self), XTHashTabPtr ht, XTHashEnumPtr en)
{
en->he_i = 0;
en->he_item = NULL;
en->he_ht = ht;
}
xtPublic void *xt_ht_next(struct XTThread *self __attribute__((unused)), XTHashEnumPtr en)
xtPublic void *xt_ht_next(struct XTThread *XT_UNUSED(self), XTHashEnumPtr en)
{
if (en->he_item) {
en->he_item = en->he_item->hi_next;
......
......@@ -31,7 +31,7 @@
#undef xt_heap_new
#endif
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xtPublic XTHeapPtr xt_mm_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc finalize, u_int line, c_char *file, xtBool track)
#else
xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc finalize)
......@@ -39,7 +39,7 @@ xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc fin
{
volatile XTHeapPtr hp;
#ifdef DEBUG
#ifdef DEBUG_MEMORY
hp = (XTHeapPtr) xt_mm_calloc(self, size, line, file);
hp->h_track = track;
if (track)
......@@ -65,21 +65,21 @@ xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc fin
return hp;
}
xtPublic void xt_check_heap(XTThreadPtr self __attribute__((unused)), XTHeapPtr hp __attribute__((unused)))
xtPublic void xt_check_heap(XTThreadPtr XT_NDEBUG_UNUSED(self), XTHeapPtr XT_NDEBUG_UNUSED(hp))
{
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xt_mm_malloc_size(self, hp);
#endif
}
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file)
#else
xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp)
#endif
{
xt_spinlock_lock(&hp->h_lock);
#ifdef DEBUG
#ifdef DEBUG_MEMORY
if (hp->h_track)
printf("HEAP: +1 %d->%d %s:%d\n", (int) hp->h_ref_count, (int) hp->h_ref_count+1, file, (int) line);
#endif
......@@ -91,7 +91,7 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
{
if (!hp)
return;
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xt_spinlock_lock(&hp->h_lock);
ASSERT(hp->h_ref_count != 0);
xt_spinlock_unlock(&hp->h_lock);
......@@ -100,7 +100,7 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
if (hp->h_onrelease)
(*hp->h_onrelease)(self, hp);
if (hp->h_ref_count > 0) {
#ifdef DEBUG
#ifdef DEBUG_MEMORY
if (hp->h_track)
printf("HEAP: -1 %d->%d\n", (int) hp->h_ref_count, (int) hp->h_ref_count-1);
#endif
......@@ -116,12 +116,12 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
xt_spinlock_unlock(&hp->h_lock);
}
xtPublic void xt_heap_set_release_callback(XTThreadPtr self __attribute__((unused)), XTHeapPtr hp, XTFinalizeFunc onrelease)
xtPublic void xt_heap_set_release_callback(XTThreadPtr XT_UNUSED(self), XTHeapPtr hp, XTFinalizeFunc onrelease)
{
hp->h_onrelease = onrelease;
}
xtPublic u_int xt_heap_get_ref_count(struct XTThread *self __attribute__((unused)), XTHeapPtr hp)
xtPublic u_int xt_heap_get_ref_count(struct XTThread *XT_UNUSED(self), XTHeapPtr hp)
{
return hp->h_ref_count;
}
......
......@@ -25,6 +25,7 @@
#include "xt_defs.h"
#include "lock_xt.h"
#include "memory_xt.h"
struct XTThread;
......@@ -59,7 +60,7 @@ u_int xt_heap_get_ref_count(struct XTThread *self, XTHeapPtr mem);
void xt_check_heap(struct XTThread *self, XTHeapPtr mem);
#ifdef DEBUG
#ifdef DEBUG_MEMORY
#define xt_heap_new(t, s, f) xt_mm_heap_new(t, s, f, __LINE__, __FILE__, FALSE)
#define xt_heap_new_track(t, s, f) xt_mm_heap_new(t, s, f, __LINE__, __FILE__, TRUE)
#define xt_heap_reference(t, s) xt_mm_heap_reference(t, s, __LINE__, __FILE__)
......
This diff is collapsed.
......@@ -24,6 +24,7 @@
#define __xt_index_h__
#ifdef DRIZZLED
#include <drizzled/definitions.h>
#include <mysys/my_bitmap.h>
#else
#include <mysql_version.h>
......@@ -34,7 +35,6 @@
#include "linklist_xt.h"
#include "datalog_xt.h"
#include "datadic_xt.h"
//#include "cache_xt.h"
#ifndef MYSQL_VERSION_ID
#error MYSQL_VERSION_ID must be defined!
......@@ -109,7 +109,7 @@ class Field;
#define XT_MAX_RECORD_REF_SIZE 8
#define XT_INDEX_PAGE_DATA_SIZE XT_INDEX_PAGE_SIZE - 2 /* NOTE: 2 == offsetof(XTIdxBranchDRec, tb_data) */
#define XT_INDEX_PAGE_DATA_SIZE (XT_INDEX_PAGE_SIZE - 2) /* NOTE: 2 == offsetof(XTIdxBranchDRec, tb_data) */
#define XT_MAKE_LEAF_SIZE(x) ((x) + offsetof(XTIdxBranchDRec, tb_data))
......@@ -218,7 +218,7 @@ typedef struct XTIndFreeList {
* in 32 threads on smalltab: runTest(SMALL_INSERT_TEST, 32, dbUrl)
*/
/*
* XT_INDEX_USE_RW_MUTEX:
* XT_INDEX_USE_RWMUTEX:
* But the RW mutex is a close second, if not just as fast.
* If it is at least as fast, then it is better because read lock
* overhead is then zero.
......@@ -240,17 +240,24 @@ typedef struct XTIndFreeList {
* Latest test show that RW mutex is slightly faster:
* 127460 to 123574 payment transactions.
*/
#define XT_INDEX_USE_RW_MUTEX
#ifdef XT_NO_ATOMICS
#define XT_INDEX_USE_PTHREAD_RW
#else
//#define XT_INDEX_USE_RWMUTEX
//#define XT_INDEX_USE_PTHREAD_RW
//#define XT_INDEX_SPINXSLOCK
#define XT_TAB_ROW_USE_XSMUTEX
#endif
#ifdef XT_INDEX_USE_FASTWRLOCK
#define XT_INDEX_LOCK_TYPE XTFastRWLockRec
#define XT_INDEX_INIT_LOCK(s, i) xt_fastrwlock_init(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_fastrwlock_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_fastrwlock_slock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_WRITE_LOCK(i, o) xt_fastrwlock_xlock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_UNLOCK(i, o) xt_fastrwlock_unlock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_HAVE_XLOCK(i, o) TRUE
#ifdef XT_TAB_ROW_USE_XSMUTEX
#define XT_INDEX_LOCK_TYPE XTXSMutexRec
#define XT_INDEX_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_xsmutex_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_xsmutex_slock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_WRITE_LOCK(i, o) xt_xsmutex_xlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_HAVE_XLOCK(i, o) ((i)->sxs_xlocker == (o)->ot_thread->t_id)
#elif defined(XT_INDEX_USE_PTHREAD_RW)
#define XT_INDEX_LOCK_TYPE xt_rwlock_type
#define XT_INDEX_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->mi_rwlock)
......@@ -259,7 +266,15 @@ typedef struct XTIndFreeList {
#define XT_INDEX_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->mi_rwlock)
#define XT_INDEX_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->mi_rwlock)
#define XT_INDEX_HAVE_XLOCK(i, o) TRUE
#else // XT_INDEX_USE_RW_MUTEX
#elif defined(XT_INDEX_SPINXSLOCK)
#define XT_INDEX_LOCK_TYPE XTSpinXSLockRec
#define XT_INDEX_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_spinxslock_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_spinxslock_slock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_WRITE_LOCK(i, o) xt_spinxslock_xlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_UNLOCK(i, o) xt_spinxslock_unlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_HAVE_XLOCK(i, o) ((i)->mi_rwlock.nrw_xlocker == (o)->ot_thread->t_id)
#else // XT_INDEX_USE_RWMUTEX
#define XT_INDEX_LOCK_TYPE XTRWMutexRec
#define XT_INDEX_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_rwmutex_free(s, &(i)->mi_rwlock)
......@@ -289,22 +304,24 @@ typedef struct XTIndex {
XTIndFreeListPtr mi_free_list; /* List of free pages for this index. */
/* Protected by the mi_dirty_lock: */
XTSpinLockRec mi_dirty_lock; /* Spin lock protecting the dirty & free lists. */
XTSpinLockRec mi_dirty_lock; /* Spin lock protecting the dirty & free lists. */
struct XTIndBlock *mi_dirty_list; /* List of dirty pages for this index. */
u_int mi_dirty_blocks; /* Count of the dirty blocks. */
/* Index contants: */
u_int mi_flags;
u_int mi_key_size;
u_int mi_max_items; /* The maximum number of items that can fit in a leaf node. */
xtBool mi_low_byte_first;
xtBool mi_fix_key;
xtBool mi_lazy_delete; /* TRUE if index entries are "lazy deleted". */
u_int mi_single_type; /* Used when the index contains a single field. */
u_int mi_select_total;
XTScanBranchFunc mi_scan_branch;
XTPrevItemFunc mi_prev_item;
XTLastItemFunc mi_last_item;
XTSimpleCompFunc mi_simple_comp_key;
MY_BITMAP mi_col_map; /* Bit-map of columns in the index. */
MX_BITMAP mi_col_map; /* Bit-map of columns in the index. */
u_int mi_subset_of; /* Indicates if this index is a complete subset of someother index. */
u_int mi_seg_count;
XTIndexSegRec mi_seg[200];
......@@ -344,6 +361,7 @@ typedef struct XTDictionary {
Field **dic_blob_cols;
/* MySQL related information. NULL when no tables are open from MySQL side! */
xtBool dic_no_lazy_delete; /* FALSE if lazy delete is OK. */
u_int dic_disable_index; /* Non-zero if the index cannot be used. */
u_int dic_index_ver; /* The version of the index. */
u_int dic_key_count;
......@@ -462,6 +480,8 @@ xtBool xt_idx_prev(register struct XTOpenTable *ot, register struct XTIndex *ind
xtBool xt_idx_read(struct XTOpenTable *ot, struct XTIndex *ind, xtWord1 *rec_buf);
void xt_ind_set_index_selectivity(XTThreadPtr self, struct XTOpenTable *ot);
void xt_check_indices(struct XTOpenTable *ot);
void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
void xt_ind_count_deleted_items(struct XTTable *ot, struct XTIndex *ind, struct XTIndBlock *block);
xtBool xt_flush_indices(struct XTOpenTable *ot, off_t *bytes_flushed, xtBool have_table_lock);
void xt_ind_track_dump_block(struct XTTable *tab, xtIndexNodeID address);
......@@ -482,6 +502,7 @@ void xt_prev_branch_item_var(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPt
void xt_last_branch_item_fix(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPtr branch, register XTIdxResultPtr result);
void xt_last_branch_item_var(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPtr branch, register XTIdxResultPtr result);
xtBool xt_idx_lazy_delete_on_leaf(XTIndexPtr ind, struct XTIndBlock *block, xtWord2 branch_size);
//#define TRACK_ACTIVITY
#ifdef TRACK_ACTIVITY
......
This diff is collapsed.
This diff is collapsed.
......@@ -59,13 +59,13 @@ void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, xt_rwlock_struct *lock)
ptr->li_lock_type = XTThreadLockInfo::RW_LOCK;
}
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTFastRWLock *lock)
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTXSMutexLock *lock)
{
ptr->li_fast_rwlock = lock;
ptr->li_lock_type = XTThreadLockInfo::FAST_RW_LOCK;
}
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSpinRWLock *lock)
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSpinXSLock *lock)
{
ptr->li_spin_rwlock = lock;
ptr->li_lock_type = XTThreadLockInfo::SPIN_RW_LOCK;
......@@ -77,6 +77,12 @@ void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTAtomicRWLock *lock)
ptr->li_lock_type = XTThreadLockInfo::ATOMIC_RW_LOCK;
}
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSkewRWLock *lock)
{
ptr->li_skew_rwlock = lock;
ptr->li_lock_type = XTThreadLockInfo::SKEW_RW_LOCK;
}
void xt_thread_lock_info_free(XTThreadLockInfoPtr ptr)
{
/* TODO: check to see if it's present in a thread's list */
......@@ -163,12 +169,12 @@ void xt_trace_thread_locks(XTThread *self)
lock_name = li->li_fast_lock->fal_name;
break;
case XTThreadLockInfo::FAST_RW_LOCK:
lock_type = "XTFastRWLock";
lock_name = li->li_fast_rwlock->frw_name;
lock_type = "XTXSMutexLock";
lock_name = li->li_fast_rwlock->xsm_name;
break;
case XTThreadLockInfo::SPIN_RW_LOCK:
lock_type = "XTSpinRWLock";
lock_name = li->li_spin_rwlock->srw_name;
lock_name = li->li_spin_rwlock->sxs_name;
break;
case XTThreadLockInfo::ATOMIC_RW_LOCK:
lock_type = "XTAtomicRWLock";
......
......@@ -25,7 +25,7 @@
#define __xt_locklist_h__
#ifdef DEBUG
//#define XT_THREAD_LOCK_INFO
#define XT_THREAD_LOCK_INFO
#ifndef XT_WIN
/* We need DEBUG_LOCKING in order to enable pthread function wrappers */
#define DEBUG_LOCKING
......@@ -40,9 +40,10 @@ struct XTRWMutex;
struct xt_mutex_struct;
struct xt_rwlock_struct;
struct XTFastLock;
struct XTFastRWLock;
struct XTSpinRWLock;
struct XTXSMutexLock;
struct XTSpinXSLock;
struct XTAtomicRWLock;
struct XTSkewRWLock;
#ifdef XT_THREAD_LOCK_INFO
......@@ -61,7 +62,7 @@ struct XTAtomicRWLock;
*/
typedef struct XTThreadLockInfo {
enum LockType { SPIN_LOCK, RW_MUTEX, MUTEX, RW_LOCK, FAST_LOCK, FAST_RW_LOCK, SPIN_RW_LOCK, ATOMIC_RW_LOCK };
enum LockType { SPIN_LOCK, RW_MUTEX, MUTEX, RW_LOCK, FAST_LOCK, FAST_RW_LOCK, SPIN_RW_LOCK, ATOMIC_RW_LOCK, SKEW_RW_LOCK };
LockType li_lock_type;
......@@ -69,11 +70,12 @@ typedef struct XTThreadLockInfo {
XTSpinLock *li_spin_lock; // SPIN_LOCK
XTRWMutex *li_rw_mutex; // RW_MUTEX
XTFastLock *li_fast_lock; // FAST_LOCK
XTFastRWLock *li_fast_rwlock; // FAST_RW_LOCK
XTSpinRWLock *li_spin_rwlock; // SPIN_RW_LOCK
XTXSMutexLock *li_fast_rwlock; // FAST_RW_LOCK
XTSpinXSLock *li_spin_rwlock; // SPIN_RW_LOCK
XTAtomicRWLock *li_atomic_rwlock; // ATOMIC_RW_LOCK
xt_mutex_struct *li_mutex; // MUTEX
xt_rwlock_struct *li_rwlock; // RW_LOCK
XTSkewRWLock *li_skew_rwlock; // SKEW_RW_LOCK
};
}
XTThreadLockInfoRec, *XTThreadLockInfoPtr;
......@@ -81,11 +83,12 @@ XTThreadLockInfoRec, *XTThreadLockInfoPtr;
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSpinLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTRWMutex *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTFastLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTFastRWLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSpinRWLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTXSMutexLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSpinXSLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTAtomicRWLock *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, xt_mutex_struct *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, xt_rwlock_struct *lock);
void xt_thread_lock_info_init(XTThreadLockInfoPtr ptr, XTSkewRWLock *lock);
void xt_thread_lock_info_free(XTThreadLockInfoPtr ptr);
void xt_thread_lock_info_add_owner (XTThreadLockInfoPtr ptr);
......
......@@ -117,7 +117,7 @@ xtPublic xtBool xt_realloc(XTThreadPtr self, void **ptr, size_t size)
return OK;
}
xtPublic void xt_free(XTThreadPtr self __attribute__((unused)), void *ptr)
xtPublic void xt_free(XTThreadPtr XT_UNUSED(self), void *ptr)
{
free(ptr);
}
......@@ -186,7 +186,7 @@ xtPublic void xt_free_ns(void *ptr)
free(ptr);
}
#ifdef DEBUG
#ifdef DEBUG_MEMORY
/*
* -----------------------------------------------------------------------
......@@ -678,7 +678,7 @@ void xt_mm_memset(void *block, void *dest, int value, size_t size)
memset(dest, value, size);
}
void *xt_mm_malloc(XTThreadPtr self, size_t size, u_int line __attribute__((unused)), c_char *file __attribute__((unused)))
void *xt_mm_malloc(XTThreadPtr self, size_t size, u_int line, c_char *file)
{
unsigned char *p;
......@@ -695,6 +695,8 @@ void *xt_mm_malloc(XTThreadPtr self, size_t size, u_int line __attribute__((unus
*(p + size + MEM_DEBUG_HDR_SIZE) = MEM_TRAILER_BYTE;
*(p + size + MEM_DEBUG_HDR_SIZE + 1L) = MEM_TRAILER_BYTE;
(void) line;
(void) file;
#ifdef RECORD_MM
xt_lock_mutex(self, &mm_mutex);
mm_add_core_ptr(self, p + MEM_DEBUG_HDR_SIZE, 0, line, file);
......@@ -704,7 +706,7 @@ void *xt_mm_malloc(XTThreadPtr self, size_t size, u_int line __attribute__((unus
return p + MEM_DEBUG_HDR_SIZE;
}
void *xt_mm_calloc(XTThreadPtr self, size_t size, u_int line __attribute__((unused)), c_char *file __attribute__((unused)))
void *xt_mm_calloc(XTThreadPtr self, size_t size, u_int line, c_char *file)
{
unsigned char *p;
......@@ -719,6 +721,8 @@ void *xt_mm_calloc(XTThreadPtr self, size_t size, u_int line __attribute__((unus
*(p + size + MEM_DEBUG_HDR_SIZE) = MEM_TRAILER_BYTE;
*(p + size + MEM_DEBUG_HDR_SIZE + 1L) = MEM_TRAILER_BYTE;
(void) line;
(void) file;
#ifdef RECORD_MM
xt_lock_mutex(self, &mm_mutex);
mm_add_core_ptr(self, p + MEM_DEBUG_HDR_SIZE, 0, line, file);
......@@ -849,7 +853,7 @@ void xt_mm_check_ptr(XTThreadPtr self, void *ptr)
xtPublic xtBool xt_init_memory(void)
{
#ifdef DEBUG
#ifdef DEBUG_MEMORY
XTThreadPtr self = NULL;
if (!xt_init_mutex_with_autoname(NULL, &mm_mutex))
......@@ -875,7 +879,7 @@ xtPublic void debug_ik_sum(void);
xtPublic void xt_exit_memory(void)
{
#ifdef DEBUG
#ifdef DEBUG_MEMORY
long mm;
int i;
......@@ -919,7 +923,7 @@ xtPublic void xt_exit_memory(void)
* MEMORY ALLOCATION UTILITIES
*/
#ifdef DEBUG
#ifdef DEBUG_MEMORY
char *xt_mm_dup_string(XTThreadPtr self, c_char *str, u_int line, c_char *file)
#else
char *xt_dup_string(XTThreadPtr self, c_char *str)
......@@ -931,7 +935,7 @@ char *xt_dup_string(XTThreadPtr self, c_char *str)
if (!str)
return NULL;
len = strlen(str);
#ifdef DEBUG
#ifdef DEBUG_MEMORY
new_str = (char *) xt_mm_malloc(self, len + 1, line, file);
#else
new_str = (char *) xt_malloc(self, len + 1);
......@@ -1020,7 +1024,7 @@ xtPublic xtBool xt_realloc(XTThreadPtr self, void **ptr, size_t size)
return *ptr != NULL;
}
xtPublic void xt_free(XTThreadPtr self __attribute__((unused)), void *ptr)
xtPublic void xt_free(XTThreadPtr XT_UNUSED(self), void *ptr)
{
char *old_ptr;
xtWord4 size;
......
......@@ -30,6 +30,10 @@
struct XTThread;
#ifdef DEBUG
#define DEBUG_MEMORY
#endif
#ifdef DEBUG_MEMORY
#define XT_MM_STACK_TRACE 200
#define XT_MM_TRACE_DEPTH 4
......@@ -109,7 +113,7 @@ void xt_free_ns(void *ptr);
#endif
#ifdef DEBUG
#ifdef DEBUG_MEMORY
#define xt_dup_string(t, s) xt_mm_dup_string(t, s, __LINE__, __FILE__)
char *xt_mm_dup_string(struct XTThread *self, const char *path, u_int line, const char *file);
......
This diff is collapsed.
......@@ -92,9 +92,6 @@ XTThreadPtr myxt_get_self();
int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *co, MX_CONST void *ch);
void myxt_get_status(XTThreadPtr self, XTStringBufferPtr strbuf);
void myxt_bitmap_init(XTThreadPtr self, MY_BITMAP *map, u_int n_bits);
void myxt_bitmap_free(XTThreadPtr self, MY_BITMAP *map);
class XTDDColumnFactory
{
public:
......
This diff is collapsed.
This diff is collapsed.
......@@ -131,4 +131,6 @@ xtWord8 xt_bytes_since_last_checkpoint(struct XTDatabase *db, xtLogID curr_log_i
void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);
void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
xtPublic void xt_xres_start_database_recovery(XTThreadPtr self, const char *path);
#endif
......@@ -234,7 +234,7 @@ xtPublic void xt_sl_delete_item_at(struct XTThread *self, XTSortedListPtr sl, si
XT_MEMMOVE(sl->sl_data, &sl->sl_data[idx * sl->sl_item_size], &sl->sl_data[(idx+1) * sl->sl_item_size], (sl->sl_usage_count-idx) * sl->sl_item_size);
}
xtPublic void xt_sl_remove_from_front(struct XTThread *self __attribute__((unused)), XTSortedListPtr sl, size_t items)
xtPublic void xt_sl_remove_from_front(struct XTThread *XT_UNUSED(self), XTSortedListPtr sl, size_t items)
{
if (sl->sl_usage_count <= items)
xt_sl_set_size(sl, 0);
......
This diff is collapsed.
......@@ -365,6 +365,7 @@ xtPublic void xt_int8_to_byte_size(xtInt8 value, char *string)
sprintf(string, "%s %s (%"PRId64" bytes)", val_str, unit, value);
}
/* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void)
{
return "1.0.08 RC";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment