@@ -420,22 +420,27 @@ void PGBackend::partial_write(
420420 if (entry.written_shards .empty () && info->partial_writes_last_complete .empty ()) {
421421 return ;
422422 }
423+ const pg_pool_t &pool = get_parent ()->get_pool ();
424+ if (pool.is_nonprimary_shard (get_parent ()->whoami_shard ().shard )) {
425+ // Don't update pwlc on nonprimary shards because they only
426+ // observe writes that update their shard
427+ return ;
428+ }
423429 auto dpp = get_parent ()->get_dpp ();
424430 ldpp_dout (dpp, 20 ) << __func__ << " version=" << entry.version
425431 << " written_shards=" << entry.written_shards
426- << " present_shards= " << entry. present_shards
427- << " pwlc= " << info->partial_writes_last_complete
432+ << " pwlc=e " << info-> partial_writes_last_complete_epoch
433+ << " : " << info->partial_writes_last_complete
428434 << " previous_version=" << previous_version
429435 << dendl;
430- const pg_pool_t &pool = get_parent ()->get_pool ();
431436 for (shard_id_t shard : pool.nonprimary_shards ) {
432437 auto pwlc_iter = info->partial_writes_last_complete .find (shard);
433438 if (!entry.is_written_shard (shard)) {
434439 if (pwlc_iter == info->partial_writes_last_complete .end ()) {
435440 // 1st partial write since all logs were updated
436441 info->partial_writes_last_complete [shard] =
437442 std::pair (previous_version, entry.version );
438-
443+ info-> partial_writes_last_complete_epoch = get_osdmap_epoch ();
439444 continue ;
440445 }
441446 auto &&[old_v, new_v] = pwlc_iter->second ;
@@ -445,7 +450,7 @@ void PGBackend::partial_write(
445450 // invalid
446451 ldpp_dout (dpp, 20 ) << __func__ << " pwlc invalid " << shard
447452 << dendl;
448- } else if (old_v. version >= entry. version .version ) {
453+ } else if (old_v >= entry.version ) {
449454 // Abnormal case - consider_adjusting_pwlc may advance pwlc
450455 // during peering because all shards have updates but these
451456 // have not been marked complete. At the end of peering
@@ -456,10 +461,12 @@ void PGBackend::partial_write(
456461 } else {
457462 old_v = previous_version;
458463 new_v = entry.version ;
464+ info->partial_writes_last_complete_epoch = get_osdmap_epoch ();
459465 }
460466 } else if (new_v == previous_version) {
461467 // Subsequent partial write, contiguous versions
462468 new_v = entry.version ;
469+ info->partial_writes_last_complete_epoch = get_osdmap_epoch ();
463470 } else {
464471 // Subsequent partial write, discontiguous versions
465472 ldpp_dout (dpp, 20 ) << __func__ << " cannot update shard " << shard
@@ -472,17 +479,19 @@ void PGBackend::partial_write(
472479 // shard is backfilling or in async recovery, pwlc is invalid
473480 ldpp_dout (dpp, 20 ) << __func__ << " pwlc invalid " << shard
474481 << dendl;
475- } else if (old_v. version >= entry. version .version ) {
482+ } else if (old_v >= entry.version ) {
476483 // Abnormal case - see above
477484 ldpp_dout (dpp, 20 ) << __func__ << " pwlc is ahead of entry " << shard
478485 << dendl;
479486 } else {
480487 old_v = new_v = entry.version ;
488+ info->partial_writes_last_complete_epoch = get_osdmap_epoch ();
481489 }
482490 }
483491 }
484- ldpp_dout (dpp, 20 ) << __func__ << " after pwlc="
485- << info->partial_writes_last_complete << dendl;
492+ ldpp_dout (dpp, 20 ) << __func__ << " after pwlc=e"
493+ << info->partial_writes_last_complete_epoch
494+ << " :" << info->partial_writes_last_complete << dendl;
486495}
487496
488497void PGBackend::remove (
0 commit comments