mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-24 10:42:31 +03:00
- Initialize member cluster ID only on connection to cluster and forget
it on disconnect. - Don't rely on own index from the view because the view may come from another member (IST/SST), instead always determine own index from own ID. Refs codership/wsrep-lib#13
This commit is contained in:
38
src/view.cpp
Normal file
38
src/view.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
*
|
||||
* This file is part of wsrep-lib.
|
||||
*
|
||||
* Wsrep-lib 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 Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Wsrep-lib is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with wsrep-lib. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "wsrep/view.hpp"
|
||||
|
||||
void wsrep::view::print(std::ostream& os) const
|
||||
{
|
||||
os << " id: " << state_id() << "\n"
|
||||
<< " status: " << status() << "\n"
|
||||
<< " prococol_version: " << protocol_version() << "\n"
|
||||
<< " final: " << final() << "\n"
|
||||
<< " own_index: " << own_index() << "\n"
|
||||
<< " members(" << members().size() << "):\n";
|
||||
|
||||
for (std::vector<wsrep::view::member>::const_iterator i(members().begin());
|
||||
i != members().end(); ++i)
|
||||
{
|
||||
os << "\t" << (i - members().begin()) /* ordinal index */
|
||||
<< ") id: " << i->id()
|
||||
<< ", name: " << i->name() << "\n";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user