Skip to content

Commit 08935b6

Browse files
rakhiagrRakhi Agrawal
andauthored
Bug fix (#555)
Co-authored-by: Rakhi Agrawal <rakagrawal@linkedin.com>
1 parent d86af09 commit 08935b6

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

restli-resources/src/main/java/com/linkedin/metadata/restli/BaseAspectRoutingResource.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -601,15 +601,24 @@ private List<INTERNAL_ASPECT_UNION> getInternalAspectsWithShadowComparison(Set<A
601601
java.util.Optional<? extends RecordTemplate> shadow = shadowResults.getOrDefault(key, java.util.Optional.empty());
602602

603603
RecordTemplate valueToUse = null;
604-
if (shadow.isPresent() && local.isPresent() && !Objects.equals(local.get(), shadow.get())) {
605-
log.warn("Aspect mismatch for URN {} and aspect {}: local = {}, shadow = {}",
606-
key.getUrn(), key.getAspectClass().getSimpleName(), local.get(), shadow.get());
607-
valueToUse = local.get();
604+
if (local.isPresent() && shadow.isPresent()) {
605+
if (Objects.equals(local.get(), shadow.get())) {
606+
// Case 1: both present and equal → use shadow
607+
valueToUse = shadow.get();
608+
} else {
609+
// Case 2: both present but not equal → use local, log warning
610+
log.warn("Aspect mismatch for URN {} and aspect {}: local = {}, shadow = {}",
611+
key.getUrn(), key.getAspectClass().getSimpleName(), local.get(), shadow.get());
612+
valueToUse = local.get();
613+
}
608614
} else if (shadow.isPresent()) {
609-
log.warn("Only shadow value present for URN {} and aspect {}", key.getUrn(), key.getAspectClass().getSimpleName());
610-
valueToUse = shadow.get();
615+
// Case 3: only shadow present → log warning, skip
616+
log.warn("Only shadow value present for URN {} and aspect {}. Skipping shadow-only data.",
617+
key.getUrn(), key.getAspectClass().getSimpleName());
611618
} else if (local.isPresent()) {
612-
log.info("Only local value present for URN {} and aspect {}. Using local.", key.getUrn(), key.getAspectClass().getSimpleName());
619+
// Case 4: only local present → use local, log warning
620+
log.warn("Only local value present for URN {} and aspect {}. Using local.",
621+
key.getUrn(), key.getAspectClass().getSimpleName());
613622
valueToUse = local.get();
614623
}
615624

0 commit comments

Comments
 (0)