diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index 6da5e0f1402..6db12b30177 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -64,61 +64,44 @@ operator<<(std::ostream& out, const lock_table_t& lock) return(lock.print(out)); } -/** Convert the member 'type_mode' into a human readable string. -@return human readable string */ -inline -std::string -ib_lock_t::type_mode_string() const -{ - std::ostringstream sout; - sout << type_string(); - static_assert(LOCK_MODE_MASK == 7, "compatibility"); - static_assert(LOCK_IS == 0, "compatibility"); - static_assert(LOCK_IX == 1, "compatibility"); - static_assert(LOCK_S == 2, "compatibility"); - static_assert(LOCK_X == 3, "compatibility"); - static_assert(LOCK_AUTO_INC == 4, "compatibility"); - static_assert(LOCK_NONE == 5, "compatibility"); - static_assert(LOCK_NONE_UNSET == 7, "compatibility"); - const char * const modes[8] = { - "IS", "IX", "S", "X", "AUTO_INC", "NONE", "?", "NONE_UNSET" - }; - - sout << " | LOCK_" << modes[mode()]; - - if (is_record_not_gap()) { - sout << " | LOCK_REC_NOT_GAP"; - } - - if (is_waiting()) { - sout << " | LOCK_WAIT"; - } - - if (is_gap()) { - sout << " | LOCK_GAP"; - } - - if (is_insert_intention()) { - sout << " | LOCK_INSERT_INTENTION"; - } - return(sout.str()); -} - inline std::ostream& ib_lock_t::print(std::ostream& out) const { - out << "[lock_t: type_mode=" << type_mode << "(" - << type_mode_string() << ")"; + static_assert(LOCK_MODE_MASK == 7, "compatibility"); + static_assert(LOCK_IS == 0, "compatibility"); + static_assert(LOCK_IX == 1, "compatibility"); + static_assert(LOCK_S == 2, "compatibility"); + static_assert(LOCK_X == 3, "compatibility"); + static_assert(LOCK_AUTO_INC == 4, "compatibility"); + static_assert(LOCK_NONE == 5, "compatibility"); + static_assert(LOCK_NONE_UNSET == 7, "compatibility"); + const char *const modes[8]= + { "IS", "IX", "S", "X", "AUTO_INC", "NONE", "?", "NONE_UNSET" }; - if (is_record_lock()) { - out << un_member.rec_lock; - } else { - out << un_member.tab_lock; - } + out << "[lock_t: type_mode=" << type_mode << "(" << type_string() + << " | LOCK_" << modes[mode()]; - out << "]"; - return(out); + if (is_record_not_gap()) + out << " | LOCK_REC_NOT_GAP"; + if (is_waiting()) + out << " | LOCK_WAIT"; + + if (is_gap()) + out << " | LOCK_GAP"; + + if (is_insert_intention()) + out << " | LOCK_INSERT_INTENTION"; + + out << ")"; + + if (is_record_lock()) + out << un_member.rec_lock; + else + out << un_member.tab_lock; + + out << "]"; + return out; } inline diff --git a/storage/innobase/include/lock0types.h b/storage/innobase/include/lock0types.h index f8bd308a8cc..b830fe10104 100644 --- a/storage/innobase/include/lock0types.h +++ b/storage/innobase/include/lock0types.h @@ -225,10 +225,6 @@ struct ib_lock_t @return the given output stream. */ std::ostream& print(std::ostream& out) const; - /** Convert the member 'type_mode' into a human readable string. - @return human readable string */ - std::string type_mode_string() const; - const char* type_string() const { switch (type_mode & LOCK_TYPE_MASK) {