Commit Graph

33602 Commits

Author SHA1 Message Date
John Spray
3bef125fe4 qa: Add smoke test for cephfs-journal-tool
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:43:54 +01:00
John Spray
b76e64b29b tools/JournalTool: Fix 'header set' corner case
If the write_pos was behind the other pointers, we
would flag the header as invalid.  However, that
would prevent doing a "header set" to correct it.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:52 +01:00
John Spray
5d913e2b1c mds: Create JournalPointer in MDLog::create
Otherwise it is created at next startup when
we see that it is missing: this is cleaner.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:52 +01:00
John Spray
bac434de0c mds: Make EMetaBlob::dirlump::_decode_bits const
This requires making the late-decoded attributes mutable.
The motivation is to allow get_paths and all the code downstream
of that to be const too.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:52 +01:00
John Spray
1c2bb37417 osdc: new style encoding for Journal::Header
Switch to the ENCODE_START, DECODE_START macros
for Journal::Header.  As well as being nice generally,
this has the important side effect of making
journal headers written since JOURNAL_FORMAT_RESILIENT
unreadable to older MDSs, as they will fail their check
on Header.magic.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:52 +01:00
John Spray
f609a0afe3 osdc: Simplify JournalStream::read
It was doing an unnecessary series of splices() after
reading header, replace with a single pass through
the data and one splice at the end.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
f12b9e8be9 osdc: make JournalStream::readable const
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
778b78519f osdc/JournalStream: DRY envelope size calc
Replace repetitive sizeof() calculation for the
envelope overhead per log event with #defines.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
45c319efeb doc: Update ceph-mds manpage
Add missing --hot-standby and --journal-check
arguments.

Fixes: #8258
2014-05-20 14:07:51 +01:00
John Spray
423dafe04d osdc/Journaler: use pointers for out params
Fixes a style violation in the new JournalStream class.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
fc1d6da713 tools/cephfs: Update for JournalPointer
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
d52eeaba42 Fix JournalStream::read length assertion
This was checking for new-format length even
when reading from an old-format journal.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
5c2a64011b osdc/Journaler: include stream_format in dump()
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
68b200940c mds: Introduce mds_journal_format config setting
This is useful for testing, so that we can create an
old-style journal and then test the version migration
by changing the config setting.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:51 +01:00
John Spray
aec4c939a7 tools: update Dumper to use JournalPointer
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
1612677b43 mds: Generalize JournalPointer functionality
...so that we can use it places like Resetter too.  And use it
there.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
8b0383ed43 dencoder: add JournalPointer to types.h
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
a4ae168ae6 mds: add atomic log rewrite on format change
Two main pieces to this:
 * A new JournalPointer object that stores two journal
   inodes so that we can do a double-buffered update,
   followed by an atomic swap.
 * An extended recovery process in MDLog that dereferences
   the JournalPointer and conditionally rewrites the
   journal to accomodate format updates.

The JournalPointer indirection should also be useful for
making cephfs-journal-tool do updates more safely.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
dba721f199 osdc: Add Journaler.erase
This is used in subsequent commits to delete journals
that are no longer needed, such as after rewriting
a journal in a different format.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
c73902b1e9 osdc/Journaler: privatize members
Many members were unnecessarily public.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
405cb8572d osdc: fix redundant branch
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
e7fa5be618 osdc: Clean up journalstream readable check
Fix redundant (and subtly incorrect) calculation of
the number of bytes needed.  It worked because waiting
for a few more bytes before reading the entry size
of an old-format entry was harmless.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
79a1e5870f mds/CDir: remove redundant inode enc/dec
Use the new CInode::encode_bare/decode_bare fns
in CDir, so that we only have one implementation
of the inode encode/decode code.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:50 +01:00
John Spray
49add98390 docs: Add cephfs-journal-tool
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:49 +01:00
John Spray
5011945faf gitignore: Add cephfs-journal-tool
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:49 +01:00
John Spray
7e4da00af4 debian: add cephfs-journal-tool to ceph-mds
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:49 +01:00
John Spray
403e0288d9 rpm: add cephfs-journal-tool to RPM build
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:49 +01:00
John Spray
f7e9ff174f tools: Create cephfs-journal-tool
This is for debugging/repairing CephFS journals.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-20 14:07:49 +01:00
John Spray
fb8f469886 mds: add getter for ESession.client_inst
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
730a0115bc mds: Add getter for EMetablob.client_name
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
220f9c96a3 mds: Add EMetaBlob::get_dentries
For tools that would like to know which dentries are
touched by a metablob, without understanding its
internal format.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
f4927f00a4 mds: switch __u32 with LogEvent::EventType typedef
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
c1b185bde8 mds: Add LogEvent::str_to_type
For cephfs-journal-tool to resolve user input to a EVENT_* constant

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
e7f4b9e22f mds: Fix Dumper::undump (missing lock)
Two problems were causing undump to fail:
* Objecter lock was not being taken around call to
  .write() and .write_full() calls, causing assertion.
* Once that is fixed, it is necessary to use a separate,
  local lock to protect the completion condition for
  write operations

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
96720b6dcb mds: Add EMetaBlob::get_inodes
Used for filtering in journal tool

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
b3e57ba588 mds: Publicize some EMetaBlob members
This makes them accessible for JournalTool.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
2282739b74 mds: Refactor CINode encoding into CInodeStore
CInode itself combined the on-disk format and
encode/decode logic with lots of other complex
behaviours.  This separates the simple parts
out so that they can be used by other tools that
are interested in looking at inodes outside of
a running MDS.

There is a small overhead because CInodeStore
can't decode a SnapRealm inline, so it keeps
a temporary copy of the encoded bufferlist.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
bf7b84c951 mds: Add get_metablob to LogEvent
Previously the only way to get at the payload
of things like EUpdate and EOpen was to replay() them
(required a full running MDS) or to use downcasting
(yuck).

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
e56b88fe13 mds: Add ENoOp for padding journals
This allows us to implement journal splicing
without moving blocks around, and without modifying
the outer journal syntax.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:29 +01:00
John Spray
74ac6e4e1b mds: Add get_paths method to EMetaBlob
Used by cephfs-journal-tool to filter events
by path fragment.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
John Spray
3fa825c9ed osdc: Revise Journaler format
* Separate journal encoding/envelope format
  code (JournalStream) from I/O code (Journaler)
* Add new sentinel and start_ptr fields to
  prefix and suffix of log events.
* Add journal encoding version to journal header

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
John Spray
928d0f58d2 mds: Fix typo 'Sesion'
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
John Spray
e3a9f66970 objecter: Don't warn on multiple admin sockets
Suppress messages about failure to register admin sockets
if they are EEXIST, because this is a case that can occur
naturally if multiple objecter/librados clients are instantiated
within the same process.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
John Spray
d4a250ca79 common: Add write_stream(ostream) to bufferlist
Enable C++ style file I/O when writing binary output
from bufferlists.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
John Spray
5b20debdcc mds: Add LogEvent::get_type_str()
Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-18 11:21:28 +01:00
Yan, Zheng
991f7f15a6 Merge pull request #1821 from ceph/mds-optracker-fixes
mds: fix Server::submit_mdlog_entry()
2014-05-18 13:42:51 +08:00
Yan, Zheng
57c89bf814 mds: fix Server::submit_mdlog_entry()
mdr can be NULL when rolling back slave update

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2014-05-18 13:38:32 +08:00
Gregory Farnum
5ace4d1af7 Merge pull request #1809 from ceph/wip-4354-mds-optracker
MDS OpTracker

Reviewed-by: Sage Weil <sage@inktank.com>
2014-05-16 15:17:00 -07:00
Greg Farnum
ee92a39bce MDS: add admin socket cleanup on shutdown
Signed-off-by: Greg Farnum <greg@inktank.com>
2014-05-16 15:15:55 -07:00
Ilya Dryomov
7a1538187f Merge pull request #1817 from ceph/wip-osdmon-pa-wait
OSDMonitor: set next commit in mon primary-affinity reply

Reviewed-by: Sage Weil <sage@inktank.com>
2014-05-16 20:37:05 +04:00