Repository navigation
EC Direct Reads: First PR, background work - #65771
Conversation
a57b81c to
152f439
Compare
152f439 to
de7f3f4
Compare
2f2a811 to
256b76c
Compare
|
Latest push to remove accidental commit to a submodule. |
256b76c to
218f35b
Compare
|
jenkins test make check arm64 |
bill-scales
left a comment
There was a problem hiding this comment.
Few minor comments plus one bug - SplitOp is broken when EC has an acting set with the same OSD representing more than one shard
|
jenkins test api |
|
Hey folks, I was reviewing the QA run which contains this PR, https://tracker.ceph.com/issues/73579, and found an error which might be related to this PR: Error in teuthology.log: Could you please check if this is related to the PR? |
|
Test failure was due to #65940 Nothing to do with this PR. @SrinivasaBharath Can you makes sure this is in the re-runs? Cheers
|
|
jenkins test make check arm64 |
|
jenkins test api |
218f35b to
4b7c559
Compare
| @@ -8451,6 +8453,29 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p, | |||
| return 0; | |||
| } | |||
|
|
|||
| void OSDMonitor::enable_pool_ec_direct_reads(pg_pool_t &p) { | |||
| if (p.is_erasure()) { | |||
There was a problem hiding this comment.
nit: an early exit would be more readable (reader doesn't need to keep in mind the possibility of else); saving one indentation would also reduce visual clutter.
There was a problem hiding this comment.
Fixed locally, ready for next PR.
| @@ -2047,16 +2047,22 @@ void PrimaryLogPG::do_op(OpRequestRef& op) | |||
| } | |||
|
|
|||
| // check for op with rwordered and rebalance or localize reads | |||
| if ((m->has_flag(CEPH_OSD_FLAG_BALANCE_READS) || m->has_flag(CEPH_OSD_FLAG_LOCALIZE_READS)) && | |||
| op->rwordered()) { | |||
| if (m->has_flag(CEPH_OSD_FLAGS_DIRECT_READ) && op->rwordered()) { | |||
There was a problem hiding this comment.
Yeah, the macro helps. My only concern is CEPH_OSD_FLAGS_DIRECT_READ is (too?) similar to CEPH_OSD_FLAG_EC_DIRECT_READ.
There was a problem hiding this comment.
Fair point. I will try to come up with something better... NON-PRIMARY read doesn't work, because EC has special cases of "direct reads" to the primary.
| if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS | | ||
| CEPH_OSD_FLAG_LOCALIZE_READS)) && | ||
| if (m->get_flags() & CEPH_OSD_FLAG_EC_DIRECT_READ) { | ||
| if (is_primary() || is_nonprimary()) { |
There was a problem hiding this comment.
This is confusing and makes the condition look like always true. A comment would be helpful.
/// acting osd that is not the primary
bool is_nonprimary() const {
return role >= 0 && pg_whoami != primary;
}
/// primary osd
bool is_primary() const {
return pg_whoami == primary;
}| { | ||
| ceph_assert(!is_primary()); | ||
| std::string_view storage_object = "replica"; | ||
| if (pool.info.is_erasure()) { | ||
| storage_object = "shard"; |
There was a problem hiding this comment.
| storage_object = "shard"; | |
| const auto storage_object = pool.info.is_erasure() ? "shard"sv : "replica"sv; |
There was a problem hiding this comment.
Yes, I debated putting in this code as you say, but it did not result in any faster code from what I could tell by reading around. I went for this because it looks more conventional (and therefore more readable).
However, given you are the second person to query this, I think its probably better to change it to the more obviously efficient variant.
There was a problem hiding this comment.
I would argue that the performance isn't so important unless a profiller says it is ;-).
My comment is purely about human readability. I think the crux is in const, which reduces the number of moving parts I need to track in my mind – const means can I delegate out the checking no-modifications of this part-of-state to a compiler.
There was a problem hiding this comment.
Fixed locally, will be in next PR
rzarzynski
left a comment
There was a problem hiding this comment.
Went through all commits. Generally LGTM; just a bunch of questions and nits.
| @@ -281,6 +281,7 @@ bool ECBackend::_handle_message( | |||
| reply->min_epoch = get_parent()->get_interval_start_epoch(); | |||
| handle_sub_read(op->op.from, op->op, &(reply->op), _op->pg_trace); | |||
| reply->trace = _op->pg_trace; | |||
| reply->pgid.reset_shard(op->op.from.shard); | |||
There was a problem hiding this comment.
ACK. As directs reads become possible only after all OSDs are at U, there is no worry about compatibility.
| } | ||
|
|
||
| if (get_parent()->get_local_missing().is_missing(hoid)) { | ||
| return -EIO; // Permission denied (cos its missing) |
There was a problem hiding this comment.
How a client is going to behave in that case? Will it fallback to reading-through-primary?
There was a problem hiding this comment.
This is wrong.
This should be -EAGAIN. You cannot do that here due to a quirk of PrimaryLogPG, which would discard the op if this function returned -EAGAIN. The missing detection should be in PrimaryLogPG before it gets to the EC sync read calls.
It worked in this version, because any failure gets failed up to split ops, which retries the IO. I want to clean this up and optimised to use the original op if no splitting is required.
TL;DR: This is being fixed in next PR.
There was a problem hiding this comment.
This code is never called unless the split ops flag is enabled, so its safe to merge.
| uint32_t op_flags, | ||
| ceph::buffer::list *bl) { | ||
| if (get_parent()->get_local_missing().is_missing(hoid)) { | ||
| return -EACCES; // Permission denied (cos its missing) |
There was a problem hiding this comment.
Same question as above.
Also, isn't mixing EIO / EACCESS confusing?
There was a problem hiding this comment.
Same answer as before ;-)
| soid, op.extent.offset, op.extent.length, op.flags, &osd_op.outdata); | ||
|
|
||
| dout(20) << " EC sync read for " << soid << " result=" << result << dendl; | ||
| } else { | ||
| ctx->pending_async_reads.push_back( |
There was a problem hiding this comment.
Refactoring this code in next PR.
| @@ -6000,6 +6009,7 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) { | |||
| r = rep_repair_primary_object(soid, ctx); | |||
| } | |||
| if (r < 0) { | |||
| dout(10) << " sparse_read failed r=" << r << " from object " << soid << dendl; | |||
There was a problem hiding this comment.
Just to the record: I was looking how the new objects_readv_sync() is triggered. The answer is: just above PGBackend::objects_readv_sync() is called already:
bufferlist data_bl;
r = pgbackend->objects_readv_sync(soid, m, op.flags, &data_bl);
if (r == -EIO) {
r = rep_repair_primary_object(soid, ctx);
}ECSwitch overloads the stub of PGBackend:
virtual int objects_readv_sync(
const hobject_t &hoid,
std::map<uint64_t, uint64_t>& m,
uint32_t op_flags,
ceph::buffer::list *bl) {
return -EOPNOTSUPP;
}|
|
||
| // Reject if direct reads not supported by profile. | ||
| if (!pi->has_flag(pg_pool_t::FLAG_CLIENT_SPLIT_READS)) { | ||
| ldout(cct, DBG_LVL) << __func__ <<" REJECT: split reads off" << dendl; |
There was a problem hiding this comment.
Not sure we want to keep everything at 20 but fine for now.
There was a problem hiding this comment.
This is to allow me to switch everything to LVL 0 to just get split ops debug in the client debug, without having to filter it.
I will review it later, when code is stable.
| } | ||
|
|
||
| if (split_read->abort) { | ||
| ldout(cct, DBG_LVL) << __func__ <<" ABORTED 1" << dendl;return false; |
| } | ||
|
|
||
| if (split_read->abort) { | ||
| ldout(cct, DBG_LVL) << __func__ <<" ABORTED 2" << dendl; |
|
|
||
| // This may not actually be the primary, but since all shards are kept current | ||
| // in replica, it does not actually matter which we choose here. Choose 0 since | ||
| // there will always be a read to this shard. |
There was a problem hiding this comment.
Hmm, what about creating load asymmetry?
There was a problem hiding this comment.
I will address in comment, but I don't think it will create significant asymmetry.
The shard that we will pick here is that chosen by calc_target for replica balanced reads. i.e. it should be well balanced.
I do plan on refactoring the code to change the name of this field to be something other than "primary_shard". Perhaps "reference_shard" is good... with a note that reference shard is always primary on EC.
…ead" These flags will currently behave as follows: 1. The pool flag is never set, unless by a user with the osd_pool_default_flags config option. 2. The pool flag will be removed for EC pools where the plugin does not support direct reads. 3. Replica pools will never remove the flag. The intention is to eventually invert this logic and allow split IOs upon upgrade to Umberella in this same function. Signed-off-by: Alex Ainscow <[email protected]>
The old chunk_aligned_shard_offset_to_ro_offset was not only unused, it didn't actually have the correct logic. We replace it here with similar, but more useful function that will be used in sparse reads for EC Signed-off-by: Alex Ainscow <[email protected]>
This is in preperation for supporting sparse and sync reads in EC. Such ops will only be supported for "balance reads". Signed-off-by: Alex Ainscow <[email protected]>
The can_serve_replica_read() function is called by replica to determine whether there are any uncommitted writes. If such writes exist, then the system will reject the IO to avoid the risk of reading data from a write which may yet be rolled back. The same code is going to be useful for EC direct reads. The string_view code is not expensive. Signed-off-by: Alex Ainscow <[email protected]>
This was not necessary prior to direct reads, but is essential when the client needs to know which shard the read came from. Signed-off-by: Alex Ainscow <[email protected]>
This allows a backend to expose how an object offset/length translates to an offset/length on a particular shard. For Replica, this is trivial. For EC, this means looking up the start and end offsets, then translating this to shard address space. Signed-off-by: Alex Ainscow <[email protected]>
Sparse reads for EC are simple to implement, as the code is essentially identical to that of replica, with some address translation. When doing a direct read in EC, only a single OSD is involved and that OSD, by definition is the only OSD involved. As such we can do the more performant sync read, rather than async read. Signed-off-by: Alex Ainscow <[email protected]>
This function is necessary for balanced reads and as such is required for EC too. Rename the function to make sense, given this change of purpose, but the functionality does not change. Signed-off-by: Alex Ainscow <[email protected]>
For direct read failures, the locking is such that we cannot immediately send a new IO without deadlocking. This new interface allows an op to be sent as an asio post. Signed-off-by: Alex Ainscow <[email protected]>
This parameter is not used by the _calc_target code. It is being removed just to clean up the code, as we are making some changes to _calc_target in later stages of the split io PR. Signed-off-by: Alex Ainscow <[email protected]>
The functionality is not altered by this commit. In the future we want to post-process split-ios after recombining the read data. Signed-off-by: Alex Ainscow <[email protected]>
…r shard This will eventually be used by SplitIo to direct ops to the correct OSD. Signed-off-by: Alex Ainscow <[email protected]>
…it op When spliting ops, certain addition sub ops (e.g. get xattr) can be simply passed through to the child op. Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
This will provide the ability for Objecter to split up certain ops and distribute them to the OSDs directly if that provides a preformance advantage. This is experimental code and is switched off unless the magic pool flags are enabled. These magic pool flags were pushed in an earlier commit in the same PR. Signed-off-by: Alex Ainscow <[email protected]>
4b7c559 to
d0724a2
Compare
|
Added copyright statements. No code changes in latest merge. |
|
jenkins test make check |
|
jenkins test make check |
4 similar comments
|
jenkins test make check |
|
jenkins test make check |
|
jenkins test make check |
|
jenkins test make check |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
This PR provides a significant amount of refactoring and preparation work for the up coming EC Direct Reads.
The main tasks are:
This should have no functional changes.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.