Commit Graph

27751 Commits

Author SHA1 Message Date
Danny Al-Gaaf
11c51e8485 rgw/rgw_metadata.cc: use static_cast<>() instead of C-Style cast
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:30:04 +02:00
Danny Al-Gaaf
e910421719 rgw: change RGWOp::name() to return string instead of char*
Return 'const string' instead of 'const char *' from RGWOp::name() to
avoid the usage of std::string:c_str() to return 'const char *' in
some cases in rgw_rest_replica_log.h.

Returning result of c_str() from a function is dangerous since the
result gets (may) invalid after the related string object gets
destroyed or out of scope (which is the case with return). So you
may end up with garbage in this case.

Related warning from cppcheck:
 [src/rgw/rgw_rest_replica_log.h:39]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call.
 [src/rgw/rgw_rest_replica_log.h:59]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call.
 [src/rgw/rgw_rest_replica_log.h:79]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call

This should also fix:

CID 1049250 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.
CID 1049251 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.
CID 1049252 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:02:18 +02:00
Sage Weil
73b4003f65 Merge remote-tracking branch 'gh/wip-swift' into next
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-07-19 21:08:18 -07:00
Sage Weil
0356eebfa5 mon/PaxosService: update on_active() docs to clarify calling rules
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:59:15 -07:00
Sage Weil
6d326b8424 mon/OSDMonitor: discard failure waiters, info on shutdown
This would prevent a leak, if we didn't assert before that in the
failure_reporter_t dtor.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:57:04 -07:00
Sage Weil
8371680bab mon: OSDMonitor: only thrash and propose if we are the leader
'thrash_map' is only set if we are the leader, so we would thrash and
propose the pending value if we are the leader.  However, we should keep
the 'is_leader()' check not only for clarity's sake (an unfamiliar reader
may cry OMGBUG, prompting to a patch much like this), but also because
we may lose a subsequent election and become a peon instead, while still
holding a 'thrash_map' value > 0 -- and we really don't want to propose
while being a peon.

[This is a rebased version of 5eac38797d,
complete with the typo fix in d656aed599ee754646e16386ce5a4ab0117f2d6e.]

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:49 -07:00
Sage Weil
e4f2e3ecd0 mon/OSDMonitor: do not wait for readable in send_latest()
send_latest() checks for readable and, if untrue, will wait before sending
out the latest OSDMap.  This is completely unnecessary; I think it is a
hold-over from when we have independent paxos states.  An audit of all
callers confirms that everyone would be happy with whatever is committed,
even if we are in the process of committing an even newer version.

Effectively, everyone waits *above* this layer in the usual PaxosService
traps for whether we are readable or not.  This means that waiting_for_map
and send_to_waiting() go away entirely, which is nice.

This addresses, among other things: send_to_waiting() is called from
update_from_paxos(), which can be called when we are not readable due to
the paxos commit/finish timing changes in f1ce8d7c95 and
c711203c0d.  If no subsequent update happens, those waiters never get
their maps.

Instead, we send them immediately--we know they are committed and old
history is as good as future history.

Fixes: #5643
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:49 -07:00
Sage Weil
6edec516bf Revert "mon/OSDMonitor: send_to_waiting() in on_active()"
This reverts commit f06a124a7f.

On peons, on_active() is only called when we *first* become active after an
election.  Only on the leader is it called after each commit/update.  This
makes this change cause other problems (broken subscriptions on peons, in
particular).  We possibly should fix that, but there is also a simpler fix
for the original problem we were trying to solve.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:47 -07:00
Sage Weil
2795eb1232 Revert "mon: OSDMonitor: only thrash and propose if we are the leader"
This reverts commit 5eac38797d.
2013-07-19 16:23:04 -07:00
Sage Weil
0a9964934d Revert "mon/OSDMonitor: fix typo"
This reverts commit d656aed599.
2013-07-19 16:22:48 -07:00
Dan Mick
8c5e1db4fb ceph_rest_api.py: remove unused imports
Fixes: #5684
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 15:09:00 -07:00
Dan Mick
ce46961e32 ceph.in: better error message when daemon command returns nothing
Fixes: #5683
signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 15:01:18 -07:00
Sage Weil
06ae53e2b6 mon: improve osdmap subscription debug output
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 14:50:03 -07:00
Sage Weil
d3902e2e31 Merge remote-tracking branch 'gh/wip-stats' into next
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 14:49:25 -07:00
Greg Farnum
bc1aca77ea Merge branch 'wip-rgw-next-2' into next
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-07-19 13:25:48 -07:00
Yehuda Sadeh
da8584f15f rgw: remove extra unused param from RGWRados::get_attr()
No user for the extra obj_version param.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:50 -07:00
Yehuda Sadeh
d44082e421 cls_rgw: quiet down verbose log message
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:50 -07:00
Yehuda Sadeh
4e05786a58 rgw: replace logic that compares regions
The logic was a bit broken. Basically, we want to make sure
that region names are the same. However, if region name is not
set then we need to check whether it's the master region. This
can happen in upgrade cases where originally we didn't have
a region name set.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:50 -07:00
Yehuda Sadeh
e4d2787b02 rgw-admin: link / unlink should report errors
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:50 -07:00
Yehuda Sadeh
0024e5aa22 rgw: fix time parsing in replica log
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
7cd0bd85d4 rgw: bucket entry point object ver fixes
Multiple fixes:
 - sync master, secondary entry point ver on creation
 - use correct entry point version when removing entry point
 - check correct version on bucket removal

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
89ecba209b rgw: remove s->objv_tracker
was never initialized correctly anyway. It was only supposed to
be used for buckets, but it was never initialized in that case.
Using s->bucket_info.objv_tracker instead.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
85f3f09b0a rgw: forward delete bucket request to master after removal
We can only forward the bucket removal to the master if it was
successfully removed locally.
The master region has no knowledge about whether the
bucket can be removed or not, e.g., there are still objects in the
bucket. If we send it to the master first, then it'll happily remove it
even though it might fail in the end.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
989a4d93d8 rgw: adjust error for bucket removal on secondary region
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
2e51823563 rgw: forward x_amz_meta headers when forwarding a request
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Yehuda Sadeh
4f4bdbd5cb rgw: fix bucket re-creation on secondary region
We had a problem with bucket recreation, where we identified
that bucket has already existed, but missed the fact that it's
the same bucket, so removal of the bucket index was wrong.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 13:21:49 -07:00
Sage Weil
0de708516c mon/MonClient: fix small leak
We need to delete the version_req_d here.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:48 -07:00
Sage Weil
d1b83be14c msgr: mark addr-based [lazy_]send_message and get_connection deprecated
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:48 -07:00
Sage Weil
11c47cc4e3 client: mark_down by con
We have the con handy; use it.  This avoids generate a spurious RESET
event, which we do not need or do anything useful with.  Note that in this
case we are not attaching anything to the Connection priv field.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:48 -07:00
Sage Weil
000d4d38a4 mon: mark_down session by con, not addr
We have the ConnectionRef here; use it.  This avoids generating a spurious
RESET event for the connection.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:48 -07:00
Sage Weil
30de04066d mon: break con <-> session ref cycle in mon even if shutting down
If we get a reset during shutdown, we should still break the cycle to avoid
tripping the valgrind leak detection.  Note that we are touching no
internal Monitor state here and the locking has not changed.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:48 -07:00
Sage Weil
564075c9ad msg/SimpleMessenger: remove duplicated interface docs
Document these in the interface, not the implementation; having two copies
clutters the header and invites them to get out of sync.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
27868ca5ac msgr: update docs for mark_down, mark_down_all semantics
* RESET events
* note that the reset detection only happens if it is enabled in the
  policy.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
8dcf0b199a msgr: generate reset event on mark_down to addr (not con)
If the caller is marking down an addr, they presumably don't have the
Connection* handy, so we should generate a reset event to help them
clean up con <-> session ref cycles.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
bfadcd2a0e osd/ReplicatedPG: fix obc leak on invalid LIST_SNAPS op
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
561ac0b173 osd: break con <-> session cycle when marking down old peers
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
41c67e0236 osd: make ms_handle_reset debug more useful
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 13:21:47 -07:00
Sage Weil
8574b3cdcf mon/PGMap: don't mangle stamp_delta in clear_delta()
This is a delta, not a timestamp.

This triggered when a cluster is idle for 2* the mon_delta_reset_interval,
and required a mon restart to fix.

Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 10:55:02 -07:00
Sage Weil
99fa208f32 osd: log PG state changes at level 5
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-07-19 10:45:28 -07:00
Sage Weil
c549e628a8 mon/PGMap: avoid negative pg stats when calculating rates
We periodically see strange values come out of the estimated cluster
throughput and recovery rates.  Pretty sure this is cause by feeding
negative values into the rate arithmetic and then giving the si_t
helpers mangled (sign-extended + bit shifted) values.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 10:39:19 -07:00
Sage Weil
9292c18dfc mon/PGMap: use signed values for calculated rates
si_t (and friends) does not handle signed values, but at least we can
give the Formatters unmangled values.  This shouldn't happen (tm), but
if it does this will make things a bit less confusing and makes the code
a bit less fragile.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 10:39:17 -07:00
Samuel Just
47516d9c4b ReplicatedPG: track temp collection contents, clear during on_change
We also assert in on_flushed() that the temp collection is actually
empty.

Fixes: #5670
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 10:39:02 -07:00
Samuel Just
9f56a7b8bf PG, ReplicatedPG: pass a transaction down to ReplicatedPG::on_change
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 10:39:02 -07:00
Sage Weil
2e09b6e0bc osd: add floor() method to pg/osd stat structs
We often want to maintain a nonnegative value.  We generalize
this to floors other than zero only because it makes the function
call make intuitive sense; I don't think it is at all useful.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 10:31:48 -07:00
Sage Weil
b4db58865f osd: make pool_stat_t *log_size fields signed
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 10:31:47 -07:00
Sage Weil
d3e53cd66b mon/MonClient: better debugging on version requests
From leak hunting, but useful.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 09:59:25 -07:00
Sage Weil
053659d05e msg/Pipe: work around incorrect features reported by earlier versions
If we see a peer reporting features ~0ull, we know they are deluded in a
particular way and should infer what features they *actually* have.  Do
this right when the features come over the wire to catch all users.

Fixes: #5655
Signed-off-by: Samuel Just <sam.just@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 08:09:09 -07:00
Sage Weil
f0feabe81f Message,OSD,PG: make Connection::features private
Use has_feature() method too.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 08:09:09 -07:00
Yehuda Sadeh
d1b47f40e7 test: update cli test for radosgw-admin
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 07:48:05 -07:00
Yehuda Sadeh
7a7fca46fb Merge pull request #448 from kri5/wip-5416
rgw: Adds --rgw-zone --rgw-region help text.

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
2013-07-19 07:20:51 -07:00