From 037adf4aa0e22e2c49966fddad4bdae434bcf0dd Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Tue, 16 Apr 2019 18:58:53 +0300 Subject: [PATCH 1/2] os/bluestore: be more verbose doing bluefs log replay. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueFS.cc | 43 +++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 230f677dbcd..7b866b5eccc 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -666,6 +666,8 @@ int BlueFS::_replay(bool noop) log_file, cct->_conf->bluefs_max_prefetch, false, // !random true); // ignore eof + + bool seen_recs = false; while (true) { assert((log_reader->buf.pos & ~super.block_mask()) == 0); uint64_t pos = log_reader->buf.pos; @@ -694,15 +696,31 @@ int BlueFS::_replay(bool noop) } } if (uuid != super.uuid) { - dout(10) << __func__ << " 0x" << std::hex << pos << std::dec - << ": stop: uuid " << uuid << " != super.uuid " << super.uuid - << dendl; + if (seen_recs) { + dout(10) << __func__ << " 0x" << std::hex << pos << std::dec + << ": stop: uuid " << uuid << " != super.uuid " << super.uuid + << dendl; + } else { + derr << __func__ << " 0x" << std::hex << pos << std::dec + << ": stop: uuid " << uuid << " != super.uuid " << super.uuid + << ", block dump: \n"; + bufferlist t; + t.substr_of(bl, 0, super.block_size); + t.hexdump(*_dout); + *_dout << dendl; + } break; } if (seq != log_seq + 1) { - dout(10) << __func__ << " 0x" << std::hex << pos << std::dec - << ": stop: seq " << seq << " != expected " << log_seq + 1 - << dendl; + if (seen_recs) { + dout(10) << __func__ << " 0x" << std::hex << pos << std::dec + << ": stop: seq " << seq << " != expected " << log_seq + 1 + << dendl;; + } else { + derr << __func__ << " 0x" << std::hex << pos << std::dec + << ": stop: seq " << seq << " != expected " << log_seq + 1 + << dendl;; + } break; } if (more) { @@ -711,24 +729,25 @@ int BlueFS::_replay(bool noop) bufferlist t; int r = _read(log_reader, &log_reader->buf, read_pos, more, &t, NULL); if (r < (int)more) { - dout(10) << __func__ << " 0x" << std::hex << pos - << ": stop: len is 0x" << bl.length() + more << std::dec - << ", which is past eof" << dendl; + derr << __func__ << " 0x" << std::hex << pos + << ": stop: len is 0x" << bl.length() + more << std::dec + << ", which is past eof" << dendl; break; } assert(r == (int)more); bl.claim_append(t); read_pos += r; } + seen_recs = true; bluefs_transaction_t t; try { bufferlist::iterator p = bl.begin(); ::decode(t, p); } catch (buffer::error& e) { - dout(10) << __func__ << " 0x" << std::hex << pos << std::dec - << ": stop: failed to decode: " << e.what() - << dendl; + derr << __func__ << " 0x" << std::hex << pos << std::dec + << ": stop: failed to decode: " << e.what() + << dendl; delete log_reader; return -EIO; } -- 2.17.1