mon: OSDMonitor: smaller transactions when rebuilding full versions

Otherwise, for considerably sized rebuilds, the monitor will not only
consume vast amounts of memory, but it will also have troubles committing
the transaction.  Anyway, it's also a good idea to adjust transactions to
the granularity we want, and to be fair we care that each rebuilt full map
gets to disk, even if subsequent full maps don't (those can be rebuilt
later).

Fixes: #6323

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: OSDMonitor: update latest_full while rebuilding full maps

Not doing so will make the monitor rebuild the osdmap full versions, even
though they may have been rebuilt before, every time the monitor starts.

This mostly happens when the cluster is left in an unhealthy state for
a long period of time and incremental versions build up.  Even though we
build the full maps on update_from_paxos(), not updating 'full_latest'
leads to the situation initially described.

Fixes: #6322

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: OSDMonitor: multiple rebuilt full maps per transaction

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
perfglue/heap_profiler.cc: expect args as first element on cmd vector

We used to pass 'heap' as the first element of the cmd vector when
handling commands.  We haven't been doing so for a while now, so we
needed to fix this.

Not expecting 'heap' also makes sense, considering that what we need to
know when we reach this function is what command we should handle, and
we should not care what the caller calls us when handling his business.

Fixes: #6361
Backport: dumpling

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
mds: MDS: pass only heap profiler commands instead of the whole cmd vector

The heap profiler doesn't care, nor should it, what our command name is.
It only cares about the commands it handles.

Backport: dumpling

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
osd: OSD: add 'heap' command to known osd commands array

Must have been forgotten during the cli rework.

Backport: dumpling

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
qa: workunits: cephtool: check if 'heap' commands are parseable

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
Merge pull request #612 from ceph/wip-6361

perfglue/heapprofiler: expect cmd name when handling command instead of 'heap <cmd>'

This was broken by the cli rework.

Reviewed-by: Samuel Just <sam.just@inktank.com>
Merge pull request #599 from ceph/wip-6323

mon: OSDMonitor: fix #6322 and #6323

Reviewed-by: Greg Farnum <greg@inktank.com>
osd: revert 'osd max xattr size' limit

Set it to 0 (unlimited) for now.

Backport: dumpling

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
arch/intel: use intel probe instructions for x86_64 only

Not LP64, which includes ppc64 and clearly does not build.

Fixes: #6283
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
arch/intel: fix old comment

Signed-off-by: Sage Weil <sage@inktank.com>
osd: change warn_interval_multiplier to uint32_t

to prevent overflow in OpTracker::check_ops_in_flight when
multiplying warn_interval_multiplier *= 2

Backport: cuttlefish, dumpling

http://tracker.ceph.com/issues/6370 fixes #6370

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 1bce1f009bffd3e28025a08775fec189907a81db)
mon/OSDMonitor: fix 'ceph osd crush reweight ...'

The adjust method returns a count of adjusted items.

Add a test.

Fixes: #6382
Backport: dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
qa/workunits/mon/crush_ops.sh: fix test

Fix root.

Fixes: #6392
Signed-off-by: Sage Weil <sage@inktank.com>
common/crc32c_intel_fast: fix compile-time #ifdef

This wasn't getting built in!

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
(cherry picked from commit 3233336cc3b6c2c1e89fe6c6d21d42e0f2cce142)
mon: OSDMonitor: do not write full_latest during trim

On commit 81983bab we patched OSDMonitor::update_from_paxos() such that we
write the latest full map version to 'full_latest' each time the latest
full map was built from the incremental versions.

This change however clashed with OSDMonitor::encode_trim_extra(), which
also wrote to 'full_latest' on each trim, writing instead the version of
the *oldest* full map.  This duality of behaviors could lead the store
to an inconsistent state across the monitors (although there's no sign of
it actually imposing any issues besides rebuilding already existing full
maps on some monitors).

We now stop OSDMonitor::encode_trim_extra() from writing to 'full_latest'.
This function will still write out the oldest full map it has in the store,
but it will no longer write to full_latest, instead leaving it up to
OSDMonitor::update_from_paxos() to figure it out -- and it already does.

Fixes: #6378

Backport: dumpling

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: fix bl resize on write vs truncate race

If we resize the write due to the funky truncate behavior, we need to
resize the bufferlist to match.

Fixes: #6346
Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #645 from liewegas/wip-6346

Reviewed-by: Greg Farnum <greg@inktank.com>
qa/run_xfstests.sh: use old xfstests until we adapt to new org

Tests were rearranged upstream; use an old version for the time being
until we can refactor run_xfstests.sh to cope.  See #6385

Signed-off-by: Sage Weil <sage@inktank.com>