From 9542de298eed21a0e7fd32806bcfd8dfbee0355f Mon Sep 17 00:00:00 2001 From: marko <Unknown> Date: Fri, 30 Jan 2009 11:03:11 +0000 Subject: [PATCH] branches/innodb+: Merge revisions 4063:4070 from branches/zip: ------------------------------------------------------------------------ r4070 | marko | 2009-01-30 12:58:56 +0200 (Fri, 30 Jan 2009) | 6 lines branches/zip: ibuf_use_t: Add the constant IBUF_USE_COUNT, to eliminate a gcc warning about an assertion that trivially holds. The warning was introduced in r4061, in the merge of branches/innodb+ -r4053. ibuf_insert(): Let an assertion fail if ibuf_use is unknown. ------------------------------------------------------------------------ --- handler/ha_innodb.cc | 4 ++-- ibuf/ibuf0ibuf.c | 20 +++++++++++++++----- include/ibuf0ibuf.h | 8 ++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index d97bf8414e..ea0b992da2 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -188,7 +188,7 @@ bool nw_panic = FALSE; #endif /** Allowed values of innodb_change_buffering */ -static const char* innobase_change_buffering_values[IBUF_USE_ALL + 1] = { +static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ "inserts", /* IBUF_USE_INSERT */ "deletes", /* IBUF_USE_DELETE_MARK */ @@ -9432,7 +9432,7 @@ innodb_change_buffering_update( { ut_a(var_ptr != NULL); ut_a(save != NULL); - ut_a((*(ibuf_use_t*) save) <= IBUF_USE_ALL); + ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT); ibuf_use = *(const ibuf_use_t*) save; diff --git a/ibuf/ibuf0ibuf.c b/ibuf/ibuf0ibuf.c index 784c3fdb41..93388101da 100644 --- a/ibuf/ibuf0ibuf.c +++ b/ibuf/ibuf0ibuf.c @@ -3533,6 +3533,8 @@ ibuf_insert( case IBUF_USE_INSERT: case IBUF_USE_INSERT_DELETE_MARK: case IBUF_USE_ALL: + goto notify; + case IBUF_USE_COUNT: break; } break; @@ -3545,9 +3547,11 @@ ibuf_insert( case IBUF_USE_DELETE: case IBUF_USE_INSERT_DELETE_MARK: case IBUF_USE_ALL: + ut_ad(!no_counter); + goto notify; + case IBUF_USE_COUNT: break; } - ut_ad(!no_counter); break; case IBUF_OP_DELETE: switch (use) { @@ -3558,14 +3562,20 @@ ibuf_insert( case IBUF_USE_DELETE_MARK: case IBUF_USE_DELETE: case IBUF_USE_ALL: + ut_ad(!no_counter); + goto skip_notify; + case IBUF_USE_COUNT: break; } - ut_ad(!no_counter); - goto skip_notify; - default: - ut_error; + break; + case IBUF_OP_COUNT: + break; } + /* unknown op or use */ + ut_error; + +notify: /* If another thread buffers an insert on a page while the purge is in progress, the purge for the same page must not be buffered, because it could remove a record diff --git a/include/ibuf0ibuf.h b/include/ibuf0ibuf.h index 0871209716..d1b8e6ec1b 100644 --- a/include/ibuf0ibuf.h +++ b/include/ibuf0ibuf.h @@ -28,14 +28,18 @@ typedef enum { IBUF_OP_COUNT = 3, } ibuf_op_t; -/** Combinations of operations that can be buffered. */ +/** Combinations of operations that can be buffered. Because the enum +values are used for indexing innobase_change_buffering_values[], they +should start at 0 and there should not be any gaps. */ typedef enum { IBUF_USE_NONE = 0, IBUF_USE_INSERT, /* insert */ IBUF_USE_DELETE_MARK, /* delete */ IBUF_USE_INSERT_DELETE_MARK, /* insert+delete */ IBUF_USE_DELETE, /* delete+purge */ - IBUF_USE_ALL /* insert+delete+purge */ + IBUF_USE_ALL, /* insert+delete+purge */ + + IBUF_USE_COUNT /* number of entries in ibuf_use_t */ } ibuf_use_t; /** Operations that can currently be buffered. */ -- 2.30.9