Repository navigation
Conversation
Aias00
left a comment
There was a problem hiding this comment.
Reviewed current head 9e98e8594628.
Eureka metadata/address changes now publish updates and the gateway cache updates existing same-instance upstreams without retaining stale protocol/config data.
Architecture note: Eureka upstream changes emit UPDATED and update gateway cached fields; unrelated Eureka metadata is intentionally ignored.
Validation: exact-head targeted Maven reactor tests passed on Java 17.
./mvnw -pl shenyu-admin,shenyu-loadbalancer,shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide,shenyu-registry/shenyu-registry-eureka -am test -Dtest=DefaultDiscoveryProcessorTest,DiscoveryDataChangedEventSyncListenerTest,DiscoveryUpstreamMapperTest,UpstreamCacheManagerTest,DivideUpstreamDataHandlerTest,EurekaInstanceRegisterRepositoryTest -Dsurefire.failIfNoSpecifiedTests=false -Drat.skip=true -Djacoco.skip=true -DskipRemoteResources=true -Dmaven.javadoc.skip=true
Aias00
left a comment
There was a problem hiding this comment.
Summary
Strong fix for several real bugs:
discovery-upstream-sqlmap.xml:WHERE discovery_handler_id = #{id}→#{discoveryHandlerId}. The old#{id}parameter was wrong (andnullfor fresh rows, pertestUpdatedFreshUpstreamSetsHandlerAndTimestampWithoutDatabaseId), so the UPDATE matched 0 rows and never persisted the discovery handler id/url. Important correctness fix.UpstreamCacheManager.submitDiscoverypreserves runtime state (protocol, warmup, gray, metadata, inflight, health) when discovery pushes config updates, instead of replacing the object.updateExistingUpstreamsnow also propagates config to unhealthy instances without recovering them.- Eureka
compareInstancescompares the built upstream JSON instead of the unreliableInstanceInfo.equals, andgetInstancesusesgetIPAddr()for deterministic upstream addresses.
Tests are thorough. Approving.
Non-blocking
Upstream.protocol/warmupare now mutable (with setters) to allow in-place config refresh. This is consistent with the already-mutableweight/metadatafields, but sinceUpstreamis a widely shared value object, a short comment on the intentional mutability / visibility would help future readers.getHostName()→getIPAddr()is a behavior change for Eureka-sourced upstreams. Please confirm it is intended and (if needed) call it out in the PR description for operators who relied on hostnames.
Thanks for the review. I moved the PR back to draft because I wanted to re-check the full update flow before asking for another review. After the re-check, I made one additional fix and also confirmed the intent behind the two non-blocking points you mentioned. 1.
|
Aias00
left a comment
There was a problem hiding this comment.
Re-approving. My earlier approval was auto-dismissed (branch protection re-requests review after the new commits), so I re-reviewed the current diff.
This Eureka / discovery upstream sync fix is solid and the new commits added substantial, meaningful tests:
discovery-upstream-sqlmap.xml: the buggyWHERE discovery_handler_id=#{id}is corrected to#{discoveryHandlerId}, so the update actually persists (previouslygetId()being null matched zero rows).AbstractDiscoveryProcessor.fetchAllnow publishes the persisted configuration for existing upstreams instead of registry defaults.DiscoveryDataChangedEventSyncListenersetsdateUpdatedon reconcile updates.UpstreamCacheManager.submitDiscoverypreserves runtime state (e.g.inflight, health, gray) when a protocol changes, andUpstreamnow exposes mutableprotocol/warmup(with setters) so in-place protocol updates work;updateExistingUpstreamsadditionally propagateswarmup/gray/metadata.EurekaInstanceRegisterRepository:compareInstancesnow compares the upstream JSON (not bareequals()), andgetHostName()→getIPAddr()fixes the address used for the upstream.- Divide/WebSocket handlers now call
submitDiscovery.
Tests are strong: DefaultDiscoveryProcessorTest (3 new reconciliation scenarios), UpstreamCacheManagerTest (config update preserves runtime state, unhealthy not recovered, explicit protocol deletion, distinct protocols at same URL), EurekaInstanceRegisterRepositoryTest (parameterized metadata-change publishing, no-op on unchanged/unrelated metadata, add+delete on different instance ids), plus a DiscoveryUpstreamMapperTest integration case.
The earlier blocker (no real effect) is resolved and the code is correct. Approving.
|
Heads-up: this branch now has merge conflicts with The conflict spans the discovery/upstream path you touch: Please rebase onto |
deb757e to
adf32cf
Compare
The HTTP integration failure is unrelated to the Eureka changes in this PR. #7903 changed the cryptor response plugin to return a configuration error when a configured response field is missing, while The failing run therefore receives the cryptor configuration-error response, which has no The #7903 change is already present in this PR's base branch, and this PR modifies neither the cryptor response plugin nor the failing integration test. |
Aias00
left a comment
There was a problem hiding this comment.
Approved. This is a coherent fix for Eureka discovery-upstream sync: AbstractDiscoveryProcessor.fetchAll now publishes the persisted upstream configuration (not registry defaults) for existing upstreams, UpstreamCacheManager.submitDiscovery preserves the cached instance when only the protocol changes for a URL (and processValidUpstreams now also reconciles the unhealthy pool and propagates warmup/gray onto existing entries), Upstream.setProtocol correctly refreshes protocolPrefix/selectorKey/identity, and EurekaInstanceRegisterRepository.compareInstances is rewritten to diff by instance id (IP/port change becomes delete+add, content change becomes UPDATE) and use getIPAddr() for addressing. The relaxed immutability on Upstream is contained and well defined.
Two merge notes: (1) the PR currently shows mergeable=false (a merge conflict) and must be rebased/resolved before it can be merged; (2) it edits Upstream.java and UpstreamCacheManager.java, which also overlap with the already-approved #8101 (instance draining) - please rebase on top of that work so the two changes land cleanly. (The shenyu-integrated-test-http failure is the known-flaky http integration job, unrelated to this change.)
|
Hi @lymerin, this PR was approved, but the squash-merge could not be completed because it now has merge conflicts ( This PR and #8101 (draining admission) both modify Please rebase your branch onto the latest |
Aias00
left a comment
There was a problem hiding this comment.
Reviewed Eureka updates for existing instances and propagation through Admin discovery events into gateway upstream caches. No actionable finding.
Validation: 43 focused Admin/Eureka tests passed; an additional gateway/load-balancer/Eureka reactor run passed 66 tests (including repeated coverage). The PR currently has merge conflicts; conflict resolution needs revalidation. Apache RAT passed locally. Scope: source review and targeted verification; full integration/e2e suites were not run locally for this review.
Fixes #7439.
Problem
The UPDATED predicate required matching
instanceIdvalues and!InstanceInfo.equals(). Since Eureka equality compares instance identity, configuration changes on the same instance never satisfied that predicate. The add/delete checks also treated the instance as unchanged, so no event was emitted.Impact
Changes to weight, protocol, status, or props left upstream configuration stale despite continued Eureka polling. The full-sync path also published registry defaults for existing records, conflicting with the configuration refresh needed in the gateway cache.
Changes
instanceId. For an unchanged IP and port, compare the generated upstream payload and emitUPDATEDonly when that payload changes. Unrelated metadata remains a no-op.ADDEDfor the new endpoint beforeDELETEDfor the old endpoint, with noUPDATEDevent.Validation
Targeted Java 17 regression tests and Checkstyle passed. After the final event-order adjustment, all 13 Eureka regression tests and Checkstyle passed again. The full clean install with tests passed locally.
Non-blocking note
Address replacement is limited to Eureka event classification and the existing Admin add/delete path. Gateway updates still merge non-empty upstream lists; removing an endpoint from the persisted snapshot does not itself evict that endpoint from the gateway cache. Endpoint lifecycle reconciliation is outside this PR.
Checklist
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.