Skip to content
Permalink
Browse files
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().
  • Loading branch information
dr-m committed Apr 25, 2019
1 parent ac97ad4 commit 9e7bcb0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
@@ -2721,7 +2721,7 @@ prepare_inplace_alter_table_dict(
(ha_alter_info->handler_ctx);

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_fk == !ctx->drop_fk);
DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx);
@@ -1,6 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -96,9 +97,13 @@ struct ib_sequence_t {
return(m_next_value);
}

/** Maximum calumn value if adding an AUTOINC column else 0. Once
we reach the end of the sequence it will be set to ~0. */
const ulonglong m_max_value;
/** @return maximum column value
@retval 0 if not adding AUTO_INCREMENT column */
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 */
ulong m_increment;
@@ -2727,7 +2727,7 @@ prepare_inplace_alter_table_dict(
(ha_alter_info->handler_ctx);

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_fk == !ctx->drop_fk);
DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx);
@@ -1,6 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -96,9 +97,13 @@ struct ib_sequence_t {
return(m_next_value);
}

/** Maximum calumn value if adding an AUTOINC column else 0. Once
we reach the end of the sequence it will be set to ~0. */
const ulonglong m_max_value;
/** @return maximum column value
@retval 0 if not adding AUTO_INCREMENT column */
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 */
ulong m_increment;

0 comments on commit 9e7bcb0

Please sign in to comment.