Commit 9e7bcb05 authored by Marko Mäkelä's avatar Marko Mäkelä

Clean up ib_sequence::m_max_value

Correctly document the usage of m_max_value. Remove the const
qualifier, so that the implicit assignment operator can be used.
Make all members of ib_sequence private, and add an accessor
member function max_value().
parent ac97ad4e
...@@ -2721,7 +2721,7 @@ prepare_inplace_alter_table_dict( ...@@ -2721,7 +2721,7 @@ prepare_inplace_alter_table_dict(
(ha_alter_info->handler_ctx); (ha_alter_info->handler_ctx);
DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED) DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED)
== (ctx->sequence.m_max_value > 0)); == (ctx->sequence.max_value() > 0));
DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index); DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index);
DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk); DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk);
DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx); DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -96,9 +97,13 @@ struct ib_sequence_t { ...@@ -96,9 +97,13 @@ struct ib_sequence_t {
return(m_next_value); return(m_next_value);
} }
/** Maximum calumn value if adding an AUTOINC column else 0. Once /** @return maximum column value
we reach the end of the sequence it will be set to ~0. */ @retval 0 if not adding AUTO_INCREMENT column */
const ulonglong m_max_value; ulonglong max_value() const { return m_max_value; }
private:
/** Maximum value if adding an AUTO_INCREMENT column, else 0 */
ulonglong m_max_value;
/** Value of auto_increment_increment */ /** Value of auto_increment_increment */
ulong m_increment; ulong m_increment;
......
...@@ -2727,7 +2727,7 @@ prepare_inplace_alter_table_dict( ...@@ -2727,7 +2727,7 @@ prepare_inplace_alter_table_dict(
(ha_alter_info->handler_ctx); (ha_alter_info->handler_ctx);
DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED) DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED)
== (ctx->sequence.m_max_value > 0)); == (ctx->sequence.max_value() > 0));
DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index); DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index);
DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk); DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk);
DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx); DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -96,9 +97,13 @@ struct ib_sequence_t { ...@@ -96,9 +97,13 @@ struct ib_sequence_t {
return(m_next_value); return(m_next_value);
} }
/** Maximum calumn value if adding an AUTOINC column else 0. Once /** @return maximum column value
we reach the end of the sequence it will be set to ~0. */ @retval 0 if not adding AUTO_INCREMENT column */
const ulonglong m_max_value; ulonglong max_value() const { return m_max_value; }
private:
/** Maximum value if adding an AUTO_INCREMENT column, else 0 */
ulonglong m_max_value;
/** Value of auto_increment_increment */ /** Value of auto_increment_increment */
ulong m_increment; ulong m_increment;
......
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