Ilya Dryomov [Fri, 17 Jan 2014 09:49:40 +0000 (11:49 +0200)]
rbd: expose mount_timeout map option
Expose mount_timeout map option. (I missed it in commit 9b7364d2450c,
which added -o / --options option and among other options exposed
osdkeepalive and osd_idle_ttl timeouts.)
Concubidated [Thu, 16 Jan 2014 20:12:13 +0000 (12:12 -0800)]
osd: OSDMap: fix output from ceph status --format=json for num_in_osds
num_up_osds returns as an int value, while num_in_osds returns as a string.
Since only an int can be returned from get_num_in_osds(), num_in_osds should
should also be an int to remain consistant with num_up_osds.
osd: OSDMap: build reverse name->pool map upon decoding
Commit 3d7c69fb09 introduced a new OSDMap encoding/decoding scheme.
However, while the classic decoding function still kept building the
reverse name->pool map, the new decoding function did not, causing the
monitor to be unable to map pool names to pool ids.
This patch fixes this, by factoring out the loop responsible for
populating the 'name_pool' map, as well as calling 'calc_num_osds()', to
OSDMap::post_decode() and having this function called from both the
classic and the new decode functions.
Fixes: 7166 Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
6748: rgw: Optionally return the bucket name in a response header.
This can be useful in situations where accounting of traffic is done externally
when for example HTTP traffic is cached by a reverse proxy like Varnish.
Since not all traffic reaches the RGW daemon it can't fully account all traffic
and this the caching proxy needs to be aware of which bucket the request came for.
Greg Farnum [Wed, 15 Jan 2014 22:51:35 +0000 (14:51 -0800)]
OSDMonitor: make sure we don't send out maps with a primary_temp mapping
Making sure a cluster supports primary_temp is complicated and we don't
have any of the machinery in place right now (nor a need to actually support
it). We don't have any mechanisms for setting it to begin with, so assert
that we never create anything with any such mapping in update_from_paxos()
to catch any errors.
Greg Farnum [Sat, 11 Jan 2014 00:52:39 +0000 (16:52 -0800)]
test: add an OSDMap unittest
This is not super-sophisticated, but it does basic mapping function
consistency checks and looks at the [pg|primary]_temp manipulations. If
we want to in the future, we can do these programmatically across a range
of pgids instead of just checking hash 0.
Greg Farnum [Fri, 20 Dec 2013 23:21:18 +0000 (15:21 -0800)]
OSDMap: pay attention to the temp_primary in _get_temp_osds
Switch _get_temp_osds to use pointers instead of references, and force callers
to check the out params instead of relying on a return code for if anything
was set (trying to use the return code when there are two possible outputs
does not provide useable semantics). For the new temp_primary out param, fill it
in from temp_primary if set, or from the pg_temp list if it's set, or leave
it blank if neither are.
Also, don't use pointers to heap elements. Just put the ints and vectors on
the stack, and assign/swap the out parameters with them. This is less
confusing and should be a bit faster in general.
Greg Farnum [Fri, 20 Dec 2013 22:43:03 +0000 (14:43 -0800)]
OSDMap: add primary out params to _pg_to_osds and _raw_to_up_osds
Switch to use pointers for the out parameters instead of references.
These functions are still just pointing at the front of the generated
lists for the "primary" params, but now that all their callers respect
these outputs we can add programmatic leader assignment with just these
two functions.
Greg Farnum [Thu, 19 Dec 2013 22:39:05 +0000 (14:39 -0800)]
OSDMap: add primary out params to internal _pg_to_up_acting_osds function
And use pointers instead of references for out params.
Now pg_to_up_acting_osds and pg_to_acting_osds can plug in to this slightly
more real implementation, instead of making up their own. (We are still
just using the first member anyway, but we're about to plug it into
the bottom layer of functions.)
Greg Farnum [Wed, 15 Jan 2014 23:24:38 +0000 (15:24 -0800)]
OSDMonitor: make remove_redundant_pg_temp clear primary, too
So that this works with future CRUSH changes, we copy the map and clear
out the primary_temp, then compare its output with the real map's output. If
they match, remove the primary_temp from the real map.
Greg Farnum [Thu, 12 Dec 2013 23:35:23 +0000 (15:35 -0800)]
OSDMap: add a CEPH_FEATURE_OSDMAP_ENC feature, and use new encoding
Bring our OSDMap encoding into the modern Ceph world! :) This is
fairly straightforward, but has a few rough edges:
Previously we had a "struct_v" which went at the beginning of the
OSDMap encoding, and then later on an ev "extended version" which
was used to store the more-frequently-changed OSDMap pieces. There
was no size information stored explicitly to let clients skip this,
but osd maps were always encoded into their own bufferlist before
being sent to clients, which had the same effect.
We now use the modern ENCODE_START three times:
1) for the overall OSDMap encoding,
2) for the client-usable portion of the map,
3) for the "extended" portion of the map
This will let us independently rev everything, which may come in
useful if we want to (for instance) add a "monitor" portion to the
map that the OSDs don't care about. It also makes adding new
client information a lot easier since older clients will still
be able to decode the map as a whole.
We may want to merge this OSDMAP_ENC feature with one of the others
we are creating during this cycle, since they're all very closely
related. That will also let us protect more naturally against old
clients getting a map they need to understand but can't (because
we only need the new map features-to-come when used with erasure-encoded
PGs, etc).
Greg Farnum [Fri, 20 Dec 2013 21:35:28 +0000 (13:35 -0800)]
OSDMap: implement pg_to_up_acting_osds with primary interface
Use our pointer calling conventions instead of a reference for the
new version of the function.
Right now we're just setting the primaries equal to the first member
of up and acting (or -1 if none), but very shortly we'll modify our
private OSDMap functions to export them based on the contents of temp_primary.
While in general anybody querying for the mapping information will
need to pay attention to whom the primary is as well, we have lots
of callers who will need real code changes to do so. To serve them,
we keep a version that does not export the primary, but asserts
that the primary matches the first entry in its list.
Greg Farnum [Fri, 13 Dec 2013 21:55:31 +0000 (13:55 -0800)]
OSDMap: unify the pg_to_acting_osds and pg_to_up_acting_osds implementations
These were the same except for a call to _raw_to_up_osds(). Move the
existing pg_to_up_acting_osds into a private function taking a pointer,
only fill in the up vector if it's a non-NULL pointer, and call it via
the obvious header implementations.
Greg Farnum [Tue, 14 Jan 2014 22:56:31 +0000 (14:56 -0800)]
osd: do not misuse calc_pg_role
We've been using the role returned from this to determine if we're
the primary or not. Don't.
This is mostly about removing a few asserts; while in there I also
redirected some calls to use static dereference instead of going through
the osdmap lookup path.
Loic Dachary [Tue, 14 Jan 2014 11:39:24 +0000 (12:39 +0100)]
qa: cleanup cephtool/test.sh tmp files
When run in a shared environment ( as opposed as a machine created for
the purpose of running this test only ), it is important to cleanup
leftovers to avoid poluting the /tmp space. Create a common temporary
directory for all tmp files.
Sage Weil [Mon, 13 Jan 2014 23:09:27 +0000 (15:09 -0800)]
osd/ReplicatedPG: use get_object_context in trim_object
find_object_context() has all the logic to choose a particular clone given
a logical snap. In the trim case, we want none of that: we just need to
pull the obc for a specific clone instance. Note that this changes
none of the failure cases (previous we asserted r == 0).
Sage Weil [Fri, 10 Jan 2014 00:04:21 +0000 (16:04 -0800)]
osd/ReplicatedPG: update ObjectContext's object_info_t for new hit_set objects
We were fabricating an object_info_t correctly and writing it to disk, but
it was not reflected by the in-memory ObjectContext. If something came
along quickly (like backfill) and tried to use it, the info would be
invalid.
Fix this by fabricating it in the obc and copying it to the new_obs for
the update.
Fixes: #7122 Signed-off-by: Sage Weil <sage@inktank.com>
Sage Weil [Thu, 9 Jan 2014 22:49:52 +0000 (14:49 -0800)]
osd/ReplicatedPG: always return ENOENT on deleted snap
Previously, if a snap was deleted but the clone was there and we hadn't
trimmed it yet, we would still return the data. Instead, return ENOENT
unconditionally (even it's not removed yet). This makes the behavior from
the client perspective more predictable and conistent.
Sage Weil [Thu, 9 Jan 2014 10:01:48 +0000 (02:01 -0800)]
ceph_test_rados_api_tier: partial test for promote vs snap trim race
This reliably returns ENODEV due to the test at the finish of flush. Not
because we are actually racing with trim, though: the trimmer doesn't run
at all. I believe it captures the important property, though. Namely:
we should not write a promoted object that is "behind" the snap trimmer's
progress. The fact that we are in front of it (the trimmer hasn't started
yet) should not matter since the object is logically deleted anyway.
We probably want to make the OSD return ENODEV on read in the normal case
when you try to access a clone that is pending trimming.