Repository navigation
osd: Do not remove objects with divergent logs if only partial writes. - #66698
Conversation
34c2711 to
0c51dbd
Compare
athanatos
left a comment
There was a problem hiding this comment.
I think this is right -- I'd like to see a unit test for this case specifically in TestPGLog though.
|
PGBackend::rollback_extents has specific support for skipping rollback on non-participating shards, so this fix to the !can_rollback case is sufficient. Does that sound right? I'm guessing that further narrows the conditions necessary to actually see this? |
0c51dbd to
a3e6c7c
Compare
Added. |
This is referring to Case 5, I think. So yes, there is logic in RollbackVisitor::rollback_extents to ignore non-participating shards. and where we can roll back, this is safe. It was case 1, however, that I have been able to recreate... and looking again, I wonder if this fix is complete? What I have done will stop us from removing the object, but we still add to the missing list, which seems like a strange thing to do. I think we should be behaving like the entry did not exist in the first place. I would like to discuss this with @bill-scales a bit more on Monday morning, when I have a fresh head. |
|
Mmm, I don't think it needs to be added to the missing set either -- I didn't notice that part. The local copy of the object is presumably exactly as it should be already with no further intervention, right? |
5793f7a to
d807c52
Compare
|
Latest commit changes the implementation to one which is both simpler and correctly updates the missing list. |
|
jenkins test make check |
Fixes https://tracker.ceph.com/issues/74221 Note: An AI was used to assist generating unit tests for this commit. The production code was written by the author. In the scenario we are fixing here, there is a divergent log, which needs to be rolled back. The non-primary does not participate in the transaction to the object, but the log exists describing the transaction. The primary has a different transaction and has correctly detected the divergence. The primary correctly concludes that no recovery is needed for the object, since only partial writes exist on the non-primary. The non-primary observes its divergent log and incorrectly concludes that recovery IS needed for the divergent write and prepares by removing that object. The consequence of this depends on the next operation: 1. A read will fail with -EIO 2. A RMW involving a read from the removed object will detect the failure and reconstruct the necessary data. 3. A RMW not involve the write or an append will recreate the object, but with zeros, so will cause data corruption. A It is unusual for such a log entry to exist on the non-primary because normally those are omitted from the non-primary log. The scenario that causes this when a partial write triggers a clone due to copy on write. We now have a clone operation which affects ALL shards and so the log entry is sent to all shards. This is unusual to see in the field. We must have all of the following: 1. A clone operation (these are infrequent) 2. A partial write. 3. A peering cycle must happen before this write is complete. The combination of 1 and 3 make this a very unusual operation in teuthology and will be even rarer in the field. The fix ensures we skip divergent log entries for partial writes that the shard did not participate in. The following is a minimal script to recreate: set -e -x MDS=0 MON=1 OSD=4 MGR=1 ../src/vstart.sh --debug --new -x --localhost -o timeout=10000 -o session_timeout=10000 -o debug_osd=20 ceph osd pool set noautoscale ceph balancer off ceph osd set nodeep-scrub ceph osd set noscrub ceph osd set noout ceph config set global bluestore_debug_inject_read_err true dd if=/dev/random of=file_8k bs=8k count=1 dd if=/dev/random of=file_4k bs=4k count=1 ceph osd erasure-code-profile set alex k=2 m=2 ceph osd pool create mypool --pg_num=1 --pool_type=erasure alex ceph osd pool set mypool allow_ec_overwrites true ceph osd pool set mypool allow_ec_optimizations true ceph osd pool set mypool min_size 2 rados put -p mypool test1 file_8k acting_set=$(ceph osd map mypool test1 --format=json | jq -r '.acting[]') acting_array=($acting_set) shard_0_osd=${acting_array[0]} shard_1_osd=${acting_array[1]} echo "Shard 0 OSD: $shard_0_osd" echo "Shard 1 OSD: $shard_1_osd" ceph daemon osd.$shard_0_osd injectecwriteerr mypool "*" 2 1 0 1 rados -p mypool mksnap test1_snap rados put -p mypool test1 file_4k --offset 0 & ceph osd set noup ceph osd down $shard_1_osd wait ceph osd unset noup rados -p mypool mksnap test1_snap2 rados put -p mypool test1 file_4k --offset 0 Signed-off-by: Alex Ainscow <[email protected]>
d807c52 to
65dce5e
Compare
bill-scales
left a comment
There was a problem hiding this comment.
2nd version of the change is much neater. The change boils down to ignoring log entries for partial writes that did not update the shard in _merge_object_divergent_entries when reversing out divergent entries. In particular the object isn't deleted and the missing list isn't modified.
I reviewed an earlier iteration of the unit tests and found a few places where we could assert that objects had been added to the missing list. This version of the unit tests looks fine.
| ldpp_dout(dpp, 20) << __func__ << ": ignoring " << *i << dendl; | ||
| } else if (!i->written_shards.empty() && !i->written_shards.contains(orig_shard)) { | ||
| ldpp_dout(dpp, 20) << __func__ << ": ignoring partial write " << *i << dendl; | ||
| last = i->version; |
|
jenkins test make check arm64 |
|
jenkins test windows |
|
jenkins test make check arm64 |
|
jenkins test make check arm64 |
In the scenario we are fixing here, there is a divergent log, which needs to
be rolled back. The non-primary does not participate in the transaction to
the object, but the log exists describing the transaction. The primary has
a different transaction and has correctly detected the divergence.
The primary correctly concludes that no recovery is needed for the object, since
only partial writes exist on the non-primary.
The non-primary observes its divergent log and incorrectly concludes that
recovery IS needed for the divergent write and prepares by removing that
object.
The consequence of this depends on the next operation:
and reconstruct the necessary data.
zeros, so will cause data corruption. A
It is unusual for such a log entry to exist on the non-primary because
normally those are omitted from the non-primary log. The scenario that causes
this when a partial write triggers a clone due to copy on write. We now have
a clone operation which affects ALL shards and so the log entry is sent to
all shards.
This is unusual to see in the field. We must have all of the following:
The combination of 1 and 3 make this a very unusual operation in teuthology
and will be even rarer in the field.
The fix ensures we skip divergent log entries for partial writes that the shard
did not participate in.
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.