Commit c5dacc29 authored by inaam's avatar inaam

branches/innodb+: Merge revisions 2344:2454 from branches/zip

parent 0c5b8df9
......@@ -60,4 +60,5 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(innobase ${INNOBASE_SOURCES})
ADD_DEPENDENCIES(innobase GenError)
ENDIF(NOT SOURCE_SUBLIBS)
2008-05-06 The InnoDB Team
* handler/ha_innodb.cc, include/srv0srv.h, include/sync0sync.h,
include/trx0sys.h, mysql-test/innodb-zip.result,
mysql-test/innodb-zip.test, srv/srv0srv.c, srv/srv0start.c,
sync/sync0sync.c, trx/trx0sys.c:
Implement the system tablespace tagging
* handler/ha_innodb.cc, handler/i_s.cc, include/univ.i,
srv/srv0start.c:
Add InnoDB version in INFORMATION_SCHEMA.PLUGINS.PLUGIN_VERSION,
in the startup message and in a server variable innodb_version.
* sync/sync0sync.c:
Fix a bug in the sync debug code where a lock with level
SYNC_LEVEL_VARYING would cause an assertion failure when a thread
tried to release it.
2008-04-30 The InnoDB Team
* Makefile.am:
Fix Bug#36434 ha_innodb.so is installed in the wrong directory
* handler/ha_innodb.cc:
Merge change from MySQL (Fix Bug#35406 5.1-opt crashes on select from
I_S.REFERENTIAL_CONSTRAINTS):
ChangeSet@1.2563, 2008-03-18 19:42:04+04:00, gluh@mysql.com +1 -0
* scripts/install_innodb_plugins.sql:
Added
* mysql-test/innodb.result:
Merge change from MySQL (this fixes the failing innodb test):
ChangeSet@1.1810.3601.4, 2008-02-07 02:33:21+04:00
* row/row0sel.c:
Fix Bug#35226 RBR event crashes slave
* handler/ha_innodb.cc:
Change the fix for Bug#32440 to show bytes instead of kilobytes in
INFORMATION_SCHEMA.TABLES.DATA_FREE
* handler/ha_innodb.cc, mysql-test/innodb.result,
mysql-test/innodb.test:
Fix Bug#29507 TRUNCATE shows to many rows effected
* handler/ha_innodb.cc, mysql-test/innodb.result,
mysql-test/innodb.test:
Fix Bug#35537 Innodb doesn't increment handler_update and
handler_delete
2008-04-29 The InnoDB Team
* handler/i_s.cc, include/srv0start.h, srv/srv0start.c:
Fix Bug#36310 InnoDB plugin crash
2008-04-23 The InnoDB Team
* mysql-test/innodb_bug36169.result, mysql-test/innodb_bug36169.test,
row/row0mysql.c:
Fix Bug#36169 create innodb compressed table with too large row size
crashed
* (outside the source tree):
Fix Bug#36222 New InnoDB plugin 1.0 has wrong MKDIR_P defined in
Makefile.in
2008-04-15 The InnoDB Team
InnoDB Plugin 1.0.0 released
......@@ -15,20 +15,21 @@
# Process this file with automake to create Makefile.in
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLDATAdir= $(localstatedir)
MYSQLSHAREdir= $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
pkgplugindir= $(pkglibdir)/plugin
INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/storage/innobase/include \
-I$(top_srcdir)/sql \
-I$(srcdir)
DEFS = @DEFS@
DEFS= @DEFS@
noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \
noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \
include/btr0cur.h include/btr0cur.ic \
include/btr0pcur.h include/btr0pcur.ic \
include/btr0sea.h include/btr0sea.ic \
......@@ -132,9 +133,9 @@ noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \
include/handler0alter.h \
handler/i_s.h include/ut0rbt.h
EXTRA_LIBRARIES = libinnobase.a
noinst_LIBRARIES = @plugin_innobase_static_target@
libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \
EXTRA_LIBRARIES= libinnobase.a
noinst_LIBRARIES= @plugin_innobase_static_target@
libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \
btr/btr0sea.c buf/buf0buddy.c \
buf/buf0buf.c buf/buf0flu.c \
buf/buf0lru.c buf/buf0rea.c data/data0data.c \
......@@ -175,18 +176,18 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \
handler/i_s.cc \
handler/mysql_addons.cc ut/ut0rbt.c
libinnobase_a_CXXFLAGS= $(AM_CFLAGS) $(INNODB_CFLAGS)
libinnobase_a_CFLAGS = $(AM_CFLAGS) $(INNODB_CFLAGS)
libinnobase_a_CXXFLAGS= $(AM_CFLAGS)
libinnobase_a_CFLAGS= $(AM_CFLAGS)
EXTRA_LTLIBRARIES = ha_innodb.la
pkglib_LTLIBRARIES = @plugin_innobase_shared_target@
EXTRA_LTLIBRARIES= ha_innodb.la
pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@
ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_CFLAGS = $(AM_CFLAGS) $(INNODB_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES)
ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES)
EXTRA_DIST = CMakeLists.txt plug.in \
EXTRA_DIST= CMakeLists.txt plug.in \
pars/make_bison.sh pars/make_flex.sh \
pars/pars0grm.y pars/pars0lex.l
......
......@@ -1807,7 +1807,35 @@ btr_page_split_and_insert(
} else {
direction = FSP_UP;
hint_page_no = page_no + 1;
if (page_get_n_recs(page) == 1) {
page_cur_t pcur;
/* There is only one record in the index page
therefore we can't split the node in the middle
by default. We need to determine whether the
new record will be inserted to the left or right. */
/* Read the first (and only) record in the page. */
page_cur_set_before_first(block, &pcur);
page_cur_move_to_next(&pcur);
first_rec = page_cur_get_rec(&pcur);
offsets = rec_get_offsets(
first_rec, cursor->index, offsets,
n_uniq, &heap);
/* If the new record is less than the existing record
the the split in the middle will copy the existing
record to the new node. */
if (cmp_dtuple_rec(tuple, first_rec, offsets) < 0) {
split_rec = page_get_middle_rec(page);
} else {
split_rec = NULL;
}
} else {
split_rec = page_get_middle_rec(page);
}
}
/* 2. Allocate a new page to the index */
......@@ -2947,7 +2975,7 @@ btr_index_rec_validate_report(
/*==========================*/
const page_t* page, /* in: index page */
const rec_t* rec, /* in: index record */
dict_index_t* index) /* in: index */
const dict_index_t* index) /* in: index */
{
fputs("InnoDB: Record in ", stderr);
dict_index_name_print(stderr, NULL, index);
......@@ -2963,8 +2991,8 @@ ibool
btr_index_rec_validate(
/*===================*/
/* out: TRUE if ok */
rec_t* rec, /* in: index record */
dict_index_t* index, /* in: index */
const rec_t* rec, /* in: index record */
const dict_index_t* index, /* in: index */
ibool dump_on_error) /* in: TRUE if the function
should print hex dump of record
and page on error */
......@@ -2972,7 +3000,7 @@ btr_index_rec_validate(
ulint len;
ulint n;
ulint i;
page_t* page;
const page_t* page;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
......
......@@ -1984,7 +1984,7 @@ btr_cur_optimistic_update(
corresponding to new_entry is latched in mtr.
Thus the following call is safe. */
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
FALSE, NULL, heap);
FALSE, heap);
old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry, 0);
......@@ -2261,7 +2261,7 @@ btr_cur_pessimistic_update(
purge would also have removed the clustered index record
itself. Thus the following call is safe. */
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
FALSE, *heap, *heap);
FALSE, *heap);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
roll_ptr);
......@@ -3132,7 +3132,7 @@ btr_cur_add_path_info(
/***********************************************************************
Estimates the number of rows in a given index range. */
UNIV_INTERN
ib_longlong
ib_int64_t
btr_estimate_n_rows_in_range(
/*=========================*/
/* out: estimated number of rows */
......@@ -3150,7 +3150,7 @@ btr_estimate_n_rows_in_range(
ibool diverged;
ibool diverged_lot;
ulint divergence_level;
ib_longlong n_rows;
ib_int64_t n_rows;
ulint i;
mtr_t mtr;
......@@ -3293,7 +3293,7 @@ btr_estimate_number_of_different_key_vals(
ulint n_cols;
ulint matched_fields;
ulint matched_bytes;
ib_longlong* n_diff;
ib_int64_t* n_diff;
ulint not_empty_flag = 0;
ulint total_external_size = 0;
ulint i;
......@@ -3310,7 +3310,7 @@ btr_estimate_number_of_different_key_vals(
n_cols = dict_index_get_n_unique(index);
n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_longlong));
n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t));
/* We sample some pages in the index to get an estimate */
......@@ -3413,7 +3413,7 @@ btr_estimate_number_of_different_key_vals(
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
= ((n_diff[j]
* (ib_longlong)index->stat_n_leaf_pages
* (ib_int64_t)index->stat_n_leaf_pages
+ srv_stats_sample - 1
+ total_external_size
+ not_empty_flag)
......
......@@ -24,15 +24,9 @@ Created December 2006 by Marko Makela
Protected by buf_pool_mutex. */
static ulint buf_buddy_n_frames;
#endif /* UNIV_DEBUG */
/** Counts of blocks allocated from the buddy system.
/** Statistics of the buddy system, indexed by block size.
Protected by buf_pool_mutex. */
UNIV_INTERN ulint buf_buddy_used[BUF_BUDDY_SIZES + 1];
/** Counts of blocks relocated by the buddy system.
Protected by buf_pool_mutex. */
UNIV_INTERN ib_uint64_t buf_buddy_relocated[BUF_BUDDY_SIZES + 1];
/** Durations of block relocations.
Protected by buf_pool_mutex. */
UNIV_INTERN ullint buf_buddy_relocated_duration[BUF_BUDDY_SIZES + 1];
UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1];
/**************************************************************************
Get the offset of the buddy of a compressed page frame. */
......@@ -320,7 +314,7 @@ buf_buddy_alloc_low(
block = buf_buddy_alloc_from(block->frame, i, BUF_BUDDY_SIZES);
func_exit:
buf_buddy_used[i]++;
buf_buddy_stat[i].used++;
return(block);
}
......@@ -463,9 +457,13 @@ buf_buddy_relocate(
mutex_exit(mutex);
success:
UNIV_MEM_INVALID(src, size);
buf_buddy_relocated[i]++;
buf_buddy_relocated_duration[i]
{
buf_buddy_stat_t* buddy_stat
= &buf_buddy_stat[i];
buddy_stat->relocated++;
buddy_stat->relocated_usec
+= ut_time_us(NULL) - usec;
}
return(TRUE);
}
......@@ -498,9 +496,9 @@ buf_buddy_free_low(
ut_ad(buf_pool_mutex_own());
ut_ad(!mutex_own(&buf_pool_zip_mutex));
ut_ad(i <= BUF_BUDDY_SIZES);
ut_ad(buf_buddy_used[i] > 0);
ut_ad(buf_buddy_stat[i].used > 0);
buf_buddy_used[i]--;
buf_buddy_stat[i].used--;
recombine:
UNIV_MEM_ASSERT_AND_ALLOC(buf, BUF_BUDDY_LOW << i);
ut_d(((buf_page_t*) buf)->state = BUF_BLOCK_ZIP_FREE);
......
......@@ -2646,7 +2646,7 @@ buf_page_init_for_read(
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ibool unzip, /* in: TRUE=request uncompressed page */
ib_longlong tablespace_version,/* in: prevents reading from a wrong
ib_int64_t tablespace_version,/* in: prevents reading from a wrong
version of the tablespace in case we have done
DISCARD + IMPORT */
ulint offset) /* in: page number */
......@@ -3608,7 +3608,7 @@ buf_get_latched_pages_number(void)
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
b = UT_LIST_GET_NEXT(list, b)) {
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
ut_a(buf_page_get_io_fix(b) == BUF_IO_NONE);
ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
if (b->buf_fix_count != 0
|| buf_page_get_io_fix(b) != BUF_IO_NONE) {
......
......@@ -27,12 +27,6 @@ Created 11/11/1995 Heikki Tuuri
#include "trx0sys.h"
#include "srv0srv.h"
/* When flushed, dirty blocks are searched in neighborhoods of this size, and
flushed along with the original page. */
#define BUF_FLUSH_AREA ut_min(BUF_READ_AHEAD_AREA,\
buf_pool->curr_size / 16)
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/**********************************************************************
Validates the flush list. */
......@@ -915,15 +909,21 @@ buf_flush_try_neighbors(
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
low = (offset / BUF_FLUSH_AREA) * BUF_FLUSH_AREA;
high = (offset / BUF_FLUSH_AREA + 1) * BUF_FLUSH_AREA;
if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
/* If there is little space, it is better not to flush any
block except from the end of the LRU list */
low = offset;
high = offset + 1;
} else {
/* When flushed, dirty blocks are searched in neighborhoods of
this size, and flushed along with the original page. */
ulint buf_flush_area = ut_min(BUF_READ_AHEAD_AREA,
buf_pool->curr_size / 16);
low = (offset / buf_flush_area) * buf_flush_area;
high = (offset / buf_flush_area + 1) * buf_flush_area;
}
/* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
......
......@@ -30,13 +30,13 @@ the accessed pages when deciding whether to read-ahead */
/* There must be at least this many pages in buf_pool in the area to start
a random read-ahead */
#define BUF_READ_AHEAD_RANDOM_THRESHOLD (5 + BUF_READ_AHEAD_RANDOM_AREA / 8)
#define BUF_READ_AHEAD_RANDOM_THRESHOLD (5 + buf_read_ahead_random_area / 8)
/* The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
/* The linear read-ahead threshold */
#define BUF_READ_AHEAD_LINEAR_THRESHOLD (3 * BUF_READ_AHEAD_LINEAR_AREA / 8)
#define LINEAR_AREA_THRESHOLD_COEF 5 / 8
/* If there are buf_pool->curr_size per the number below pending reads, then
read-ahead is not done: this is to prevent flooding the buffer pool with
......@@ -67,7 +67,7 @@ buf_read_page_low(
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ibool unzip, /* in: TRUE=request uncompressed page */
ib_longlong tablespace_version, /* in: if the space memory object has
ib_int64_t tablespace_version, /* in: if the space memory object has
this timestamp different from what we are giving here,
treat the tablespace as dropped; this is a timestamp we
use to stop dangling page reads from a tablespace
......@@ -177,7 +177,7 @@ buf_read_ahead_random(
ulint offset) /* in: page number of a page which the current thread
wants to access */
{
ib_longlong tablespace_version;
ib_int64_t tablespace_version;
ulint recent_blocks = 0;
ulint count;
ulint LRU_recent_limit;
......@@ -185,6 +185,7 @@ buf_read_ahead_random(
ulint low, high;
ulint err;
ulint i;
ulint buf_read_ahead_random_area;
if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */
......@@ -207,10 +208,12 @@ buf_read_ahead_random(
tablespace_version = fil_space_get_version(space);
low = (offset / BUF_READ_AHEAD_RANDOM_AREA)
* BUF_READ_AHEAD_RANDOM_AREA;
high = (offset / BUF_READ_AHEAD_RANDOM_AREA + 1)
* BUF_READ_AHEAD_RANDOM_AREA;
buf_read_ahead_random_area = BUF_READ_AHEAD_RANDOM_AREA;
low = (offset / buf_read_ahead_random_area)
* buf_read_ahead_random_area;
high = (offset / buf_read_ahead_random_area + 1)
* buf_read_ahead_random_area;
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
......@@ -324,7 +327,7 @@ buf_read_page(
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset) /* in: page number */
{
ib_longlong tablespace_version;
ib_int64_t tablespace_version;
ulint count;
ulint count2;
ulint err;
......@@ -392,7 +395,7 @@ buf_read_ahead_linear(
ulint offset) /* in: page number of a page; NOTE: the current thread
must want access to this page (see NOTE 3 above) */
{
ib_longlong tablespace_version;
ib_int64_t tablespace_version;
buf_page_t* bpage;
buf_frame_t* frame;
buf_page_t* pred_bpage = NULL;
......@@ -406,16 +409,18 @@ buf_read_ahead_linear(
ulint low, high;
ulint err;
ulint i;
const ulint buf_read_ahead_linear_area
= BUF_READ_AHEAD_LINEAR_AREA;
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
/* No read-ahead to avoid thread deadlocks */
return(0);
}
low = (offset / BUF_READ_AHEAD_LINEAR_AREA)
* BUF_READ_AHEAD_LINEAR_AREA;
high = (offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
* BUF_READ_AHEAD_LINEAR_AREA;
low = (offset / buf_read_ahead_linear_area)
* buf_read_ahead_linear_area;
high = (offset / buf_read_ahead_linear_area + 1)
* buf_read_ahead_linear_area;
if ((offset != low) && (offset != high - 1)) {
/* This is not a border page of the area: return */
......@@ -486,8 +491,8 @@ buf_read_ahead_linear(
}
}
if (fail_count > BUF_READ_AHEAD_LINEAR_AREA
- BUF_READ_AHEAD_LINEAR_THRESHOLD) {
if (fail_count > buf_read_ahead_linear_area
* LINEAR_AREA_THRESHOLD_COEF) {
/* Too many failures: return */
buf_pool_mutex_exit();
......@@ -544,10 +549,10 @@ buf_read_ahead_linear(
return(0);
}
low = (new_offset / BUF_READ_AHEAD_LINEAR_AREA)
* BUF_READ_AHEAD_LINEAR_AREA;
high = (new_offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
* BUF_READ_AHEAD_LINEAR_AREA;
low = (new_offset / buf_read_ahead_linear_area)
* buf_read_ahead_linear_area;
high = (new_offset / buf_read_ahead_linear_area + 1)
* buf_read_ahead_linear_area;
if ((new_offset != low) && (new_offset != high - 1)) {
/* This is not a border page of the area: return */
......@@ -638,7 +643,7 @@ buf_read_ibuf_merge_pages(
to get read in, before this
function returns */
const ulint* space_ids, /* in: array of space ids */
const ib_longlong* space_versions,/* in: the spaces must have
const ib_int64_t* space_versions,/* in: the spaces must have
this version number
(timestamp), otherwise we
discard the read; we use this
......@@ -723,7 +728,7 @@ buf_read_recv_pages(
ulint n_stored) /* in: number of page numbers
in the array */
{
ib_longlong tablespace_version;
ib_int64_t tablespace_version;
ulint count;
ulint err;
ulint i;
......
......@@ -561,11 +561,21 @@ dtuple_convert_big_rec(
dict_field_t* ifield;
ulint size;
ulint n_fields;
ulint local_len;
ulint local_prefix_len;
if (UNIV_UNLIKELY(!dict_index_is_clust(index))) {
return(NULL);
}
if (dict_table_get_format(index->table) < DICT_TF_FORMAT_ZIP) {
/* up to MySQL 5.1: store a 768-byte prefix locally */
local_len = BTR_EXTERN_FIELD_REF_SIZE + DICT_MAX_INDEX_COL_LEN;
} else {
/* new-format table: do not store any BLOB prefix locally */
local_len = BTR_EXTERN_FIELD_REF_SIZE;
}
ut_a(dtuple_check_typed_no_assert(entry));
size = rec_get_converted_size(index, entry, *n_ext);
......@@ -601,6 +611,8 @@ dtuple_convert_big_rec(
ulint i;
ulint longest = 0;
ulint longest_i = ULINT_MAX;
byte* data;
big_rec_field_t* b;
for (i = dict_index_get_n_unique_in_tree(index);
i < dtuple_get_n_fields(entry); i++) {
......@@ -615,13 +627,13 @@ dtuple_convert_big_rec(
if (ifield->fixed_len
|| dfield_is_null(dfield)
|| dfield_is_ext(dfield)
|| dfield_get_len(dfield) <= local_len
|| dfield_get_len(dfield)
<= BTR_EXTERN_FIELD_REF_SIZE * 2) {
goto skip_field;
}
savings = dfield_get_len(dfield)
- BTR_EXTERN_FIELD_REF_SIZE;
savings = dfield_get_len(dfield) - local_len;
/* Check that there would be savings */
if (longest >= savings) {
......@@ -651,25 +663,32 @@ dtuple_convert_big_rec(
dfield = dtuple_get_nth_field(entry, longest_i);
ifield = dict_index_get_nth_field(index, longest_i);
vector->fields[n_fields].field_no = longest_i;
local_prefix_len = local_len - BTR_EXTERN_FIELD_REF_SIZE;
vector->fields[n_fields].len = dfield_get_len(dfield);
b = &vector->fields[n_fields];
b->field_no = longest_i;
b->len = dfield_get_len(dfield) - local_prefix_len;
b->data = (char*) dfield_get_data(dfield) + local_prefix_len;
vector->fields[n_fields].data = dfield_get_data(dfield);
/* Allocate the locally stored part of the column. */
data = mem_heap_alloc(heap, local_len);
/* Set the extern field reference in dfield to zero */
dfield_set_data(dfield,
mem_heap_zalloc(heap,
BTR_EXTERN_FIELD_REF_SIZE),
BTR_EXTERN_FIELD_REF_SIZE);
dfield_set_ext(dfield);
/* Copy the local prefix. */
memcpy(data, dfield_get_data(dfield), local_prefix_len);
/* Clear the extern field reference (BLOB pointer). */
memset(data + local_prefix_len, 0, BTR_EXTERN_FIELD_REF_SIZE);
#if 0
/* The following would fail the Valgrind checks in
page_cur_insert_rec_low() and page_cur_insert_rec_zip().
The BLOB pointers in the record will be initialized after
the record and the BLOBs have been written. */
UNIV_MEM_ALLOC(dfield->data, BTR_EXTERN_FIELD_REF_SIZE);
UNIV_MEM_ALLOC(data + local_prefix_len,
BTR_EXTERN_FIELD_REF_SIZE);
#endif
dfield_set_data(dfield, data, local_len);
dfield_set_ext(dfield);
n_fields++;
(*n_ext)++;
ut_ad(n_fields < dtuple_get_n_fields(entry));
......@@ -692,16 +711,26 @@ dtuple_convert_back_big_rec(
big_rec_t* vector) /* in, own: big rec vector; it is
freed in this function */
{
big_rec_field_t* b = vector->fields;
const big_rec_field_t* const end = b + vector->n_fields;
for (; b < end; b++) {
dfield_t* dfield;
ulint i;
ulint local_len;
for (i = 0; i < vector->n_fields; i++) {
dfield = dtuple_get_nth_field(entry, b->field_no);
local_len = dfield_get_len(dfield);
dfield = dtuple_get_nth_field(entry,
vector->fields[i].field_no);
ut_ad(dfield_is_ext(dfield));
ut_ad(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
ut_ad(local_len <= DICT_MAX_INDEX_COL_LEN);
dfield_set_data(dfield,
vector->fields[i].data, vector->fields[i].len);
(char*) b->data - local_len,
b->len + local_len);
}
mem_heap_free(vector->heap);
......
......@@ -252,7 +252,10 @@ dict_boot(void)
dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
/* ROW_FORMAT = (N_COLS >> 31) ? COMPACT : REDUNDANT */
dict_mem_table_add_col(table, heap, "N_COLS", DATA_INT, 0, 4);
/* TYPE is either DICT_TABLE_ORDINARY, or (TYPE & DICT_TF_COMPACT)
and (TYPE & DICT_TF_FORMAT_MASK) are nonzero and TYPE = table->flags */
dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "MIX_LEN", DATA_INT, 0, 4);
......
......@@ -77,11 +77,13 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
if (table->flags & DICT_TF_COMPRESSED_MASK) {
if (table->flags & ~DICT_TF_COMPACT) {
ut_a(table->flags & DICT_TF_COMPACT);
mach_write_to_4(ptr, DICT_TABLE_COMPRESSED_BASE
+ ((table->flags & DICT_TF_COMPRESSED_MASK)
>> DICT_TF_COMPRESSED_SHIFT));
ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
ut_a((table->flags & DICT_TF_ZSSIZE_MASK)
<= (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT));
ut_a(!(table->flags & (~0 << DICT_TF_BITS)));
mach_write_to_4(ptr, table->flags);
} else {
mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
}
......@@ -255,9 +257,13 @@ dict_build_table_def_step(
is_path = FALSE;
}
ut_ad(dict_table_get_format(table) <= DICT_TF_FORMAT_MAX);
ut_ad(!dict_table_zip_size(table)
|| dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
dict_table_zip_size(table),
table->flags == DICT_TF_COMPACT ? 0 : table->flags,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = (unsigned int) space;
......@@ -272,10 +278,8 @@ dict_build_table_def_step(
mtr_commit(&mtr);
} else {
/* Create in the system tablespace: disallow compression */
if (table->flags & DICT_TF_COMPRESSED_MASK) {
return(DB_TABLE_ZIP_NO_IBD);
}
/* Create in the system tablespace: disallow new features */
table->flags &= DICT_TF_COMPACT;
}
row = dict_create_sys_tables_tuple(table, node->heap);
......
......@@ -342,7 +342,7 @@ void
dict_table_autoinc_initialize(
/*==========================*/
dict_table_t* table, /* in/out: table */
ib_longlong value) /* in: next value to assign to a row */
ib_uint64_t value) /* in: next value to assign to a row */
{
ut_ad(mutex_own(&table->autoinc_mutex));
......@@ -354,13 +354,13 @@ dict_table_autoinc_initialize(
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
UNIV_INTERN
ib_longlong
ib_uint64_t
dict_table_autoinc_read(
/*====================*/
/* out: value for a new row, or 0 */
const dict_table_t* table) /* in: table */
{
ib_longlong value;
ib_int64_t value;
ut_ad(mutex_own(&table->autoinc_mutex));
......@@ -383,7 +383,7 @@ dict_table_autoinc_update(
/*======================*/
dict_table_t* table, /* in/out: table */
ib_longlong value) /* in: value which was assigned to a row */
ib_uint64_t value) /* in: value which was assigned to a row */
{
if (table->autoinc_inited && value > table->autoinc) {
......@@ -1419,7 +1419,7 @@ dict_index_add_to_cache(
new_index->stat_n_diff_key_vals = mem_heap_alloc(
new_index->heap,
(1 + dict_index_get_n_unique(new_index))
* sizeof(ib_longlong));
* sizeof(ib_int64_t));
/* Give some sensible values to stat_n_... in case we do
not calculate statistics quickly enough */
......@@ -3592,7 +3592,7 @@ dict_foreign_parse_drop_constraints(
ptr = dict_accept(cs, ptr, "FOREIGN", &success);
if (!success) {
if (!success || !my_isspace(cs, *ptr)) {
goto loop;
}
......@@ -4087,12 +4087,13 @@ dict_table_print_low(
fprintf(stderr,
"--------------------------------------\n"
"TABLE: name %s, id %lu %lu, columns %lu, indexes %lu,"
" appr.rows %lu\n"
"TABLE: name %s, id %lu %lu, flags %lx, columns %lu,"
" indexes %lu, appr.rows %lu\n"
" COLUMNS: ",
table->name,
(ulong) ut_dulint_get_high(table->id),
(ulong) ut_dulint_get_low(table->id),
(ulong) table->flags,
(ulong) table->n_cols,
(ulong) UT_LIST_GET_LEN(table->indexes),
(ulong) table->stat_n_rows);
......@@ -4154,7 +4155,7 @@ dict_index_print_low(
/*=================*/
dict_index_t* index) /* in: index */
{
ib_longlong n_vals;
ib_int64_t n_vals;
ulint i;
const char* type_string;
......@@ -4484,7 +4485,7 @@ dict_table_find_equivalent_index(
table, column_names, index->n_fields,
index, TRUE, FALSE);
mem_free(column_names);
mem_free((void*) column_names);
return(equiv_index);
}
......
......@@ -223,11 +223,11 @@ dict_print(void)
}
/************************************************************************
Determine the compressed page size of a table described in SYS_TABLES. */
Determine the flags of a table described in SYS_TABLES. */
static
ulint
dict_sys_tables_get_zip_size(
/*=========================*/
dict_sys_tables_get_flags(
/*======================*/
/* out: compressed page size in kilobytes;
or 0 if the tablespace is uncompressed,
ULINT_UNDEFINED on error */
......@@ -236,29 +236,53 @@ dict_sys_tables_get_zip_size(
const byte* field;
ulint len;
ulint n_cols;
ulint table_type;
ulint flags;
field = rec_get_nth_field_old(rec, 5, &len);
ut_a(len == 4);
table_type = mach_read_from_4(field);
flags = mach_read_from_4(field);
if (UNIV_LIKELY(flags == DICT_TABLE_ORDINARY)) {
return(0);
}
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
if (UNIV_EXPECT(n_cols & 0x80000000UL, 0x80000000UL)
&& UNIV_LIKELY(table_type > DICT_TABLE_COMPRESSED_BASE)
&& UNIV_LIKELY(table_type
<= DICT_TABLE_COMPRESSED_BASE + 16)) {
if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) {
/* New file formats require ROW_FORMAT=COMPACT. */
return(ULINT_UNDEFINED);
}
switch (flags & (DICT_TF_FORMAT_MASK | DICT_TF_COMPACT)) {
default:
case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT:
case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
/* flags should be DICT_TABLE_ORDINARY,
or DICT_TF_FORMAT_MASK should be nonzero. */
return(ULINT_UNDEFINED);
return(table_type - DICT_TABLE_COMPRESSED_BASE);
case DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
#if DICT_TF_FORMAT_MAX > DICT_TF_FORMAT_ZIP
# error "missing case labels for DICT_TF_FORMAT_ZIP .. DICT_TF_FORMAT_MAX"
#endif
/* We support this format. */
break;
}
if (UNIV_LIKELY(table_type == DICT_TABLE_ORDINARY)) {
return(0);
if (UNIV_UNLIKELY((flags & DICT_TF_ZSSIZE_MASK)
> (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT))) {
/* Unsupported compressed page size. */
return(ULINT_UNDEFINED);
}
if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) {
/* Some unused bits are set. */
return(ULINT_UNDEFINED);
}
return(flags);
}
/************************************************************************
......@@ -321,14 +345,28 @@ dict_check_tablespaces_and_store_max_id(
const byte* field;
ulint len;
ulint space_id;
ulint zip_size_in_k;
ulint flags;
char* name;
field = rec_get_nth_field_old(rec, 0, &len);
name = mem_strdupl((char*) field, len);
zip_size_in_k = dict_sys_tables_get_zip_size(rec);
ut_a(zip_size_in_k != ULINT_UNDEFINED);
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
field = rec_get_nth_field_old(rec, 5, &len);
flags = mach_read_from_4(field);
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary"
" has unknown type %lx.\n",
(ulong) flags);
goto loop;
}
field = rec_get_nth_field_old(rec, 9, &len);
ut_a(len == 4);
......@@ -352,8 +390,7 @@ dict_check_tablespaces_and_store_max_id(
object and check that the .ibd file exists. */
fil_open_single_table_tablespace(FALSE, space_id,
zip_size_in_k * 1024,
name);
flags, name);
}
mem_free(name);
......@@ -784,7 +821,6 @@ dict_load_table(
ulint n_cols;
ulint flags;
ulint err;
ulint zip_size_in_k;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
......@@ -833,8 +869,21 @@ dict_load_table(
/* Check if the tablespace exists and has the right name */
if (space != 0) {
zip_size_in_k = dict_sys_tables_get_zip_size(rec);
ut_a(zip_size_in_k != ULINT_UNDEFINED);
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
field = rec_get_nth_field_old(rec, 5, &len);
flags = mach_read_from_4(field);
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary"
" has unknown type %lx.\n",
(ulong) flags);
goto err_exit;
}
if (fil_space_for_table_exists_in_mem(space, name, FALSE,
FALSE, FALSE)) {
......@@ -853,7 +902,7 @@ dict_load_table(
name, (ulong)space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
TRUE, space, zip_size_in_k << 10, name)) {
TRUE, space, flags, name)) {
/* We failed to find a sensible tablespace
file */
......@@ -861,7 +910,7 @@ dict_load_table(
}
}
} else {
zip_size_in_k = 0;
flags = 0;
}
ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
......@@ -869,8 +918,6 @@ dict_load_table(
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
flags = zip_size_in_k << DICT_TF_COMPRESSED_SHIFT;
/* The high-order bit of N_COLS is the "compact format" flag. */
if (n_cols & 0x80000000UL) {
flags |= DICT_TF_COMPACT;
......@@ -886,17 +933,6 @@ dict_load_table(
field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field);
zip_size_in_k = dict_sys_tables_get_zip_size(rec);
if (UNIV_UNLIKELY(zip_size_in_k == ULINT_UNDEFINED)) {
field = rec_get_nth_field_old(rec, 5, &len);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: table %s: unknown table type %lu\n",
name, (ulong) mach_read_from_4(field));
goto err_exit;
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......
......@@ -42,6 +42,7 @@ dict_mem_table_create(
mem_heap_t* heap;
ut_ad(name);
ut_a(!(flags & (~0 << DICT_TF_BITS)));
heap = mem_heap_create(DICT_HEAP_SIZE);
......
This diff is collapsed.
This diff is collapsed.
......@@ -136,7 +136,8 @@ hash_create_mutexes_func(
{
ulint i;
ut_a(n_mutexes > 0 && ut_is_2pow(n_mutexes));
ut_a(n_mutexes > 0);
ut_a(ut_is_2pow(n_mutexes));
table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t));
......
This diff is collapsed.
......@@ -73,7 +73,7 @@ class ha_innobase: public handler
void update_thd();
int change_active_index(uint keynr);
int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret);
int innobase_read_and_init_auto_inc(ulonglong* ret);
ulong innobase_autoinc_lock();
ulong innobase_set_max_autoinc(ulonglong auto_inc);
ulong innobase_reset_autoinc(ulonglong auto_inc);
......@@ -263,4 +263,5 @@ convert_error_code_to_mysql(
/*========================*/
/* out: MySQL error code */
int error, /* in: InnoDB error code */
ulint flags, /* in: InnoDB table flags, or 0 */
MYSQL_THD thd); /* in: user thread handle or NULL */
......@@ -720,7 +720,8 @@ ha_innobase::add_index(
break;
default:
error = convert_error_code_to_mysql(
trx->error_state, user_thd);
trx->error_state, innodb_table->flags,
user_thd);
}
row_mysql_unlock_data_dictionary(trx);
......@@ -872,7 +873,9 @@ ha_innobase::add_index(
}
convert_error:
error = convert_error_code_to_mysql(error, user_thd);
error = convert_error_code_to_mysql(error,
innodb_table->flags,
user_thd);
}
mem_heap_free(heap);
......@@ -1095,7 +1098,7 @@ ha_innobase::final_drop_index(
transaction depends on an index that is being dropped. */
err = convert_error_code_to_mysql(
row_merge_lock_table(prebuilt->trx, prebuilt->table, LOCK_X),
user_thd);
prebuilt->table->flags, user_thd);
if (UNIV_UNLIKELY(err)) {
......
This diff is collapsed.
......@@ -12,7 +12,9 @@ Created July 18, 2007 Vasil Dimov
extern struct st_mysql_plugin i_s_innodb_trx;
extern struct st_mysql_plugin i_s_innodb_locks;
extern struct st_mysql_plugin i_s_innodb_lock_waits;
extern struct st_mysql_plugin i_s_innodb_zip;
extern struct st_mysql_plugin i_s_innodb_zip_reset;
extern struct st_mysql_plugin i_s_innodb_cmp;
extern struct st_mysql_plugin i_s_innodb_cmp_reset;
extern struct st_mysql_plugin i_s_innodb_cmpmem;
extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
#endif /* i_s_h */
......@@ -1896,6 +1896,7 @@ ibuf_add_free_page(void)
{
mtr_t mtr;
page_t* header_page;
ulint flags;
ulint zip_size;
ulint page_no;
page_t* page;
......@@ -1906,7 +1907,8 @@ ibuf_add_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &zip_size), &mtr);
mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
zip_size = dict_table_flags_to_zip_size(flags);
header_page = ibuf_header_page_get(&mtr);
......@@ -1988,6 +1990,7 @@ ibuf_remove_free_page(void)
mtr_t mtr;
mtr_t mtr2;
page_t* header_page;
ulint flags;
ulint zip_size;
ulint page_no;
page_t* page;
......@@ -1998,7 +2001,8 @@ ibuf_remove_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &zip_size), &mtr);
mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
zip_size = dict_table_flags_to_zip_size(flags);
header_page = ibuf_header_page_get(&mtr);
......@@ -2169,7 +2173,7 @@ ibuf_get_merge_page_nos(
rec_t* rec, /* in: record from which we read up and down
in the chain of records */
ulint* space_ids,/* in/out: space id's of the pages */
ib_longlong* space_versions,/* in/out: tablespace version
ib_int64_t* space_versions,/* in/out: tablespace version
timestamps; used to prevent reading in old
pages after DISCARD + IMPORT tablespace */
ulint* page_nos,/* in/out: buffer for at least
......@@ -2343,7 +2347,7 @@ ibuf_contract_ext(
btr_pcur_t pcur;
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint space_ids[IBUF_MAX_N_PAGES_MERGED];
ib_longlong space_versions[IBUF_MAX_N_PAGES_MERGED];
ib_int64_t space_versions[IBUF_MAX_N_PAGES_MERGED];
ulint n_stored;
ulint sum_sizes;
mtr_t mtr;
......@@ -2930,7 +2934,7 @@ ibuf_insert_low(
ulint err;
ibool do_merge;
ulint space_ids[IBUF_MAX_N_PAGES_MERGED];
ib_longlong space_versions[IBUF_MAX_N_PAGES_MERGED];
ib_int64_t space_versions[IBUF_MAX_N_PAGES_MERGED];
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint n_stored;
ulint bits;
......
......@@ -469,8 +469,8 @@ ibool
btr_index_rec_validate(
/*===================*/
/* out: TRUE if ok */
rec_t* rec, /* in: index record */
dict_index_t* index, /* in: index */
const rec_t* rec, /* in: index record */
const dict_index_t* index, /* in: index */
ibool dump_on_error); /* in: TRUE if the function
should print hex dump of record
and page on error */
......
......@@ -422,7 +422,7 @@ btr_cur_parse_del_mark_set_sec_rec(
/***********************************************************************
Estimates the number of rows in a given index range. */
UNIV_INTERN
ib_longlong
ib_int64_t
btr_estimate_n_rows_in_range(
/*=========================*/
/* out: estimated number of rows */
......
......@@ -50,15 +50,21 @@ buf_buddy_free(
ulint size) /* in: block size, up to UNIV_PAGE_SIZE */
__attribute__((nonnull));
/** Counts of blocks allocated from the buddy system.
Protected by buf_pool_mutex. */
extern ulint buf_buddy_used[BUF_BUDDY_SIZES + 1];
/** Counts of blocks relocated by the buddy system.
Protected by buf_pool_mutex. */
extern ib_uint64_t buf_buddy_relocated[BUF_BUDDY_SIZES + 1];
/** Durations of block relocations.
/** Statistics of buddy blocks of a given size. */
struct buf_buddy_stat_struct {
/** Number of blocks allocated from the buddy system. */
ulint used;
/** Number of blocks relocated by the buddy system. */
ib_uint64_t relocated;
/** Total duration of block relocations, in microseconds. */
ib_uint64_t relocated_usec;
};
typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
/** Statistics of the buddy system, indexed by block size.
Protected by buf_pool_mutex. */
extern ullint buf_buddy_relocated_duration[BUF_BUDDY_SIZES + 1];
extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1];
#ifndef UNIV_NONINL
# include "buf0buddy.ic"
......
......@@ -916,7 +916,7 @@ buf_page_init_for_read(
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ibool unzip, /* in: TRUE=request uncompressed page */
ib_longlong tablespace_version,/* in: prevents reading from a wrong
ib_int64_t tablespace_version,/* in: prevents reading from a wrong
version of the tablespace in case we have done
DISCARD + IMPORT */
ulint offset);/* in: page number */
......
......@@ -278,7 +278,7 @@ buf_page_get_mutex(
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
ut_error;
break;
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
return(&buf_pool_zip_mutex);
......
......@@ -73,7 +73,7 @@ buf_read_ibuf_merge_pages(
to get read in, before this
function returns */
const ulint* space_ids, /* in: array of space ids */
const ib_longlong* space_versions,/* in: the spaces must have
const ib_int64_t* space_versions,/* in: the spaces must have
this version number
(timestamp), otherwise we
discard the read; we use this
......
......@@ -74,8 +74,6 @@ enum db_err {
DB_PRIMARY_KEY_IS_NULL, /* a column in the PRIMARY KEY
was found to be NULL */
DB_TABLE_ZIP_NO_IBD, /* trying to create a compressed
table in the system tablespace */
/* The following are partial failure codes */
DB_FAIL = 1000,
......
......@@ -179,12 +179,12 @@ void
dict_table_autoinc_initialize(
/*==========================*/
dict_table_t* table, /* in/out: table */
ib_longlong value); /* in: next value to assign to a row */
ib_uint64_t value); /* in: next value to assign to a row */
/************************************************************************
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
UNIV_INTERN
ib_longlong
ib_uint64_t
dict_table_autoinc_read(
/*====================*/
/* out: value for a new row, or 0 */
......@@ -198,7 +198,7 @@ dict_table_autoinc_update(
/*======================*/
dict_table_t* table, /* in/out: table */
ib_longlong value); /* in: value which was assigned to a row */
ib_uint64_t value); /* in: value which was assigned to a row */
/************************************************************************
Release the autoinc lock.*/
UNIV_INTERN
......@@ -631,6 +631,32 @@ dict_table_is_comp(
compact page format */
const dict_table_t* table); /* in: table */
/************************************************************************
Determine the file format of a table. */
UNIV_INLINE
ulint
dict_table_get_format(
/*==================*/
/* out: file format version */
const dict_table_t* table); /* in: table */
/************************************************************************
Set the file format of a table. */
UNIV_INLINE
void
dict_table_set_format(
/*==================*/
dict_table_t* table, /* in/out: table */
ulint format);/* in: file format version */
/************************************************************************
Extract the compressed page size from table flags. */
UNIV_INLINE
ulint
dict_table_flags_to_zip_size(
/*=========================*/
/* out: compressed page size,
or 0 if not compressed */
ulint flags) /* in: flags */
__attribute__((const));
/************************************************************************
Check whether the table uses the compressed compact page format. */
UNIV_INLINE
ulint
......
......@@ -349,6 +349,57 @@ dict_table_is_comp(
return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT));
}
/************************************************************************
Determine the file format of a table. */
UNIV_INLINE
ulint
dict_table_get_format(
/*==================*/
/* out: file format version */
const dict_table_t* table) /* in: table */
{
ut_ad(table);
return((table->flags & DICT_TF_FORMAT_MASK) >> DICT_TF_FORMAT_SHIFT);
}
/************************************************************************
Determine the file format of a table. */
UNIV_INLINE
void
dict_table_set_format(
/*==================*/
dict_table_t* table, /* in/out: table */
ulint format) /* in: file format version */
{
ut_ad(table);
table->flags = (table->flags & ~DICT_TF_FORMAT_MASK)
| (format << DICT_TF_FORMAT_SHIFT);
}
/************************************************************************
Extract the compressed page size from table flags. */
UNIV_INLINE
ulint
dict_table_flags_to_zip_size(
/*=========================*/
/* out: compressed page size,
or 0 if not compressed */
ulint flags) /* in: flags */
{
ulint zip_size = flags & DICT_TF_ZSSIZE_MASK;
if (UNIV_UNLIKELY(zip_size)) {
zip_size = ((PAGE_ZIP_MIN_SIZE >> 1)
<< (zip_size >> DICT_TF_ZSSIZE_SHIFT));
ut_ad(zip_size <= UNIV_PAGE_SIZE);
}
return(zip_size);
}
/************************************************************************
Check whether the table uses the compressed compact page format. */
UNIV_INLINE
......@@ -361,8 +412,7 @@ dict_table_zip_size(
{
ut_ad(table);
return(UNIV_UNLIKELY((table->flags & DICT_TF_COMPRESSED_MASK)
<< (10 - DICT_TF_COMPRESSED_SHIFT)));
return(dict_table_flags_to_zip_size(table->flags));
}
/************************************************************************
......
......@@ -40,12 +40,32 @@ combination of types */
#define DICT_TABLE_CLUSTER 3 /* this means that the table is
really a cluster definition */
#endif
#define DICT_TABLE_COMPRESSED_BASE 0x8000 /* compressed tablespace */
/* Table flags */
#define DICT_TF_COMPACT 1 /* compact page format */
#define DICT_TF_COMPRESSED_MASK 62 /* compressed page size, KiB */
#define DICT_TF_COMPRESSED_SHIFT 1
/* Table flags. All unused bits must be 0. */
#define DICT_TF_COMPACT 1 /* Compact page format.
This must be set for
new file formats
(later than
DICT_TF_FORMAT_51). */
/* compressed page size (0=uncompressed, up to 15 compressed sizes) */
#define DICT_TF_ZSSIZE_SHIFT 1
#define DICT_TF_ZSSIZE_MASK (15 << DICT_TF_ZSSIZE_SHIFT)
#define DICT_TF_ZSSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1)
#define DICT_TF_FORMAT_SHIFT 5 /* file format */
#define DICT_TF_FORMAT_MASK (127 << DICT_TF_FORMAT_SHIFT)
#define DICT_TF_FORMAT_51 0 /* InnoDB/MySQL up to 5.1 */
#define DICT_TF_FORMAT_ZIP 1 /* InnoDB plugin for 5.1:
compressed tables,
new BLOB treatment */
#define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP
#define DICT_TF_BITS 6 /* number of flag bits */
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
#endif
/**************************************************************************
Creates a table memory object. */
......@@ -226,7 +246,7 @@ struct dict_index_struct{
indexes;/* list of indexes of the table */
btr_search_t* search_info; /* info used in optimistic searches */
/*----------------------*/
ib_longlong* stat_n_diff_key_vals;
ib_int64_t* stat_n_diff_key_vals;
/* approximate number of different key values
for this index, for each n-column prefix
where n <= dict_get_n_unique(index); we
......@@ -314,6 +334,7 @@ struct dict_table_struct{
unsigned space:32;
/* space where the clustered index of the
table is placed */
unsigned flags:DICT_TF_BITS;/* DICT_TF_COMPACT, ... */
unsigned ibd_file_missing:1;
/* TRUE if this is in a single-table
tablespace and the .ibd file is missing; then
......@@ -326,7 +347,6 @@ struct dict_table_struct{
TABLESPACE */
unsigned cached:1;/* TRUE if the table object has been added
to the dictionary cache */
unsigned flags:8;/* DICT_TF_COMPACT, ... */
unsigned n_def:10;/* number of columns defined so far */
unsigned n_cols:10;/* number of columns */
dict_col_t* cols; /* array of column descriptions */
......@@ -397,7 +417,7 @@ struct dict_table_struct{
unsigned stat_initialized:1; /* TRUE if statistics have
been calculated the first time
after database startup or table creation */
ib_longlong stat_n_rows;
ib_int64_t stat_n_rows;
/* approximate number of rows in the table;
we periodically calculate new estimates */
ulint stat_clustered_index_size;
......@@ -425,9 +445,9 @@ struct dict_table_struct{
/* TRUE if the autoinc counter has been
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
ib_longlong autoinc;/* autoinc counter value to give to the
ib_uint64_t autoinc;/* autoinc counter value to give to the
next inserted row */
ib_longlong autoinc_increment;
ib_int64_t autoinc_increment;
/* The increment step of the auto increment
column. Value must be greater than or equal
to 1 */
......
......@@ -133,7 +133,7 @@ extern ulint fil_n_pending_tablespace_flushes;
/***********************************************************************
Returns the version number of a tablespace, -1 if not found. */
UNIV_INTERN
ib_longlong
ib_int64_t
fil_space_get_version(
/*==================*/
/* out: version number, -1 if the tablespace does not
......@@ -214,6 +214,15 @@ fil_space_get_size(
/* out: space size, 0 if space not found */
ulint id); /* in: space id */
/***********************************************************************
Returns the flags of the space. The tablespace must be cached
in the memory cache. */
UNIV_INTERN
ulint
fil_space_get_flags(
/*================*/
/* out: flags, ULINT_UNDEFINED if space not found */
ulint id); /* in: space id */
/***********************************************************************
Returns the compressed page size of the space, or 0 if the space
is not compressed. The tablespace must be cached in the memory cache. */
UNIV_INTERN
......@@ -397,8 +406,7 @@ fil_create_new_single_table_tablespace(
table */
ibool is_temp, /* in: TRUE if a table created with
CREATE TEMPORARY TABLE */
ulint zip_size, /* in: compressed page size,
or 0 if uncompressed tablespace */
ulint flags, /* in: tablespace flags */
ulint size); /* in: the initial size of the
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
......@@ -424,8 +432,7 @@ fil_open_single_table_tablespace(
faster (the OS caches them) than
accessing the first page of the file */
ulint id, /* in: space id */
ulint zip_size, /* in: compressed page size,
or 0 if uncompressed tablespace */
ulint flags, /* in: tablespace flags */
const char* name); /* in: table name in the
databasename/tablename format */
/************************************************************************
......@@ -479,7 +486,7 @@ fil_tablespace_deleted_or_being_deleted_in_mem(
/* out: TRUE if does not exist or is being\
deleted */
ulint id, /* in: space id */
ib_longlong version);/* in: tablespace_version should be this; if
ib_int64_t version);/* in: tablespace_version should be this; if
you pass -1 as the value of this, then this
parameter is ignored */
/***********************************************************************
......
......@@ -46,26 +46,25 @@ void
fsp_init(void);
/*==========*/
/**************************************************************************
Gets the current free limit of a tablespace. The free limit means the
place of the first page which has never been put to the the free list
for allocation. The space above that address is initialized to zero.
Sets also the global variable log_fsp_current_free_limit. */
Gets the current free limit of the system tablespace. The free limit
means the place of the first page which has never been put to the the
free list for allocation. The space above that address is initialized
to zero. Sets also the global variable log_fsp_current_free_limit. */
UNIV_INTERN
ulint
fsp_header_get_free_limit(
/*======================*/
fsp_header_get_free_limit(void);
/*===========================*/
/* out: free limit in megabytes */
ulint space); /* in: space id, must be 0 */
/**************************************************************************
Gets the size of the tablespace from the tablespace header. If we do not
have an auto-extending data file, this should be equal to the size of the
data files. If there is an auto-extending data file, this can be smaller. */
Gets the size of the system tablespace from the tablespace header. If
we do not have an auto-extending data file, this should be equal to
the size of the data files. If there is an auto-extending data file,
this can be smaller. */
UNIV_INTERN
ulint
fsp_header_get_tablespace_size(
/*===========================*/
fsp_header_get_tablespace_size(void);
/*================================*/
/* out: size in pages */
ulint space); /* in: space id, must be 0 */
/**************************************************************************
Reads the file space size stored in the header page. */
UNIV_INTERN
......@@ -83,6 +82,14 @@ fsp_header_get_space_id(
/* out: space id, ULINT UNDEFINED if error */
const page_t* page); /* in: first page of a tablespace */
/**************************************************************************
Reads the space flags from the first page of a tablespace. */
UNIV_INTERN
ulint
fsp_header_get_flags(
/*=================*/
/* out: flags */
const page_t* page); /* in: first page of a tablespace */
/**************************************************************************
Reads the compressed page size from the first page of a tablespace. */
UNIV_INTERN
ulint
......@@ -101,8 +108,8 @@ fsp_header_init_fields(
/*===================*/
page_t* page, /* in/out: first page in the space */
ulint space_id, /* in: space id */
ulint zip_size); /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint flags); /* in: tablespace flags (FSP_SPACE_FLAGS):
0, or table->flags if newer than COMPACT */
/**************************************************************************
Initializes the space header of a new created space and creates also the
insert buffer tree root if space == 0. */
......@@ -357,6 +364,7 @@ fseg_validate(
/* out: TRUE if ok */
fseg_header_t* header, /* in: segment header */
mtr_t* mtr2); /* in: mtr */
#ifdef UNIV_BTR_PRINT
/***********************************************************************
Writes info of a segment. */
UNIV_INTERN
......@@ -365,6 +373,7 @@ fseg_print(
/*=======*/
fseg_header_t* header, /* in: segment header */
mtr_t* mtr); /* in: mtr */
#endif /* UNIV_BTR_PRINT */
/* Flags for fsp_reserve_free_extents */
#define FSP_NORMAL 1000000
......
......@@ -70,6 +70,7 @@ hash_get_mutex_no(
hash_table_t* table, /* in: hash table */
ulint fold) /* in: fold */
{
ut_ad(ut_is_2pow(table->n_mutexes));
return(ut_2pow_remainder(fold, table->n_mutexes));
}
......
......@@ -46,7 +46,7 @@ ulint
log_calc_where_lsn_is(
/*==================*/
/* out: log file number */
ib_longlong* log_file_offset, /* out: offset in that file
ib_int64_t* log_file_offset, /* out: offset in that file
(including the header) */
ib_uint64_t first_header_lsn, /* in: first log file start
lsn */
......@@ -54,7 +54,7 @@ log_calc_where_lsn_is(
determine */
ulint n_log_files, /* in: total number of log
files */
ib_longlong log_file_size); /* in: log file size
ib_int64_t log_file_size); /* in: log file size
(including the header) */
/****************************************************************
Writes to the log the string given. The log must be released with
......
......@@ -287,8 +287,8 @@ mach_write_ull(
{
ut_ad(b);
mach_write_to_4(b, n >> 32);
mach_write_to_4(b + 4, n);
mach_write_to_4(b, (ulint) (n >> 32));
mach_write_to_4(b + 4, (ulint) n);
}
/************************************************************
......
......@@ -130,8 +130,8 @@ flag value must give the length also! */
/* copy compact record list end
to a new created index page */
#define MLOG_COMP_PAGE_REORGANIZE ((byte)46) /* reorganize an index page */
#define MLOG_ZIP_FILE_CREATE ((byte)47) /* log record about creating a
compressed .ibd file */
#define MLOG_FILE_CREATE2 ((byte)47) /* log record about creating
an .ibd file, with format */
#define MLOG_ZIP_WRITE_NODE_PTR ((byte)48) /* write the node pointer of
a record on a compressed
non-leaf B-tree page */
......
......@@ -43,7 +43,7 @@ extern ulint os_n_pending_writes;
#ifdef __WIN__
#define os_file_t HANDLE
#define OS_FILE_FROM_FD(fd) _get_osfhandle(fd)
#define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
#else
typedef int os_file_t;
#define OS_FILE_FROM_FD(fd) fd
......@@ -159,7 +159,7 @@ bigger than 4000 bytes */
struct os_file_stat_struct{
char name[OS_FILE_MAX_PATH]; /* path to a file */
os_file_type_t type; /* file type */
ib_longlong size; /* file size */
ib_int64_t size; /* file size */
time_t ctime; /* creation time */
time_t mtime; /* modification time */
time_t atime; /* access time */
......@@ -385,9 +385,9 @@ os_file_get_size(
size */
ulint* size_high);/* out: most significant 32 bits of size */
/***************************************************************************
Gets file size as a 64-bit integer ib_longlong. */
Gets file size as a 64-bit integer ib_int64_t. */
UNIV_INTERN
ib_longlong
ib_int64_t
os_file_get_size_as_iblonglong(
/*===========================*/
/* out: size in bytes, -1 if error */
......
......@@ -40,7 +40,7 @@ struct os_event_struct {
in the signaled state, i.e., a thread
does not stop if it tries to wait for
this event */
ib_longlong signal_count; /* this is incremented each time
ib_int64_t signal_count; /* this is incremented each time
the event becomes signaled */
pthread_cond_t cond_var; /* condition variable is used in
waiting for the event */
......@@ -118,7 +118,7 @@ that this thread should not wait in case of an intervening call to
os_event_set() between this os_event_reset() and the
os_event_wait_low() call. See comments for os_event_wait_low(). */
UNIV_INTERN
ib_longlong
ib_int64_t
os_event_reset(
/*===========*/
os_event_t event); /* in: event to reset */
......@@ -155,7 +155,7 @@ void
os_event_wait_low(
/*==============*/
os_event_t event, /* in: event to wait */
ib_longlong reset_sig_count);/* in: zero or the value
ib_int64_t reset_sig_count);/* in: zero or the value
returned by previous call of
os_event_reset(). */
......
This diff is collapsed.
......@@ -104,7 +104,7 @@ ibool
page_zip_decompress(
/*================*/
/* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size;
page_zip_des_t* page_zip,/* in: data, ssize;
out: m_start, m_end, m_nonempty, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */
__attribute__((nonnull));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -91,6 +91,7 @@ extern ibool srv_have_fullfsync;
#endif
extern ibool srv_is_being_started;
extern ibool srv_was_started;
extern ibool srv_startup_is_before_trx_rollback_phase;
extern ibool srv_is_being_shut_down;
......
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.
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.
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.
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