Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging issues about dual read mode #927

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.43.11] - 2023-08-01
- fix logging issues about observer host and dual read mode

## [29.43.10] - 2023-07-24
- set log level of dual read mode changes to info.

Expand Down Expand Up @@ -5509,7 +5512,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.43.10...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.43.11...master
[29.43.11]: https://github.com/linkedin/rest.li/compare/v29.43.10...v29.43.11
[29.43.10]: https://github.com/linkedin/rest.li/compare/v29.43.9...v29.43.10
[29.43.9]: https://github.com/linkedin/rest.li/compare/v29.43.8...v29.43.9
[29.43.8]: https://github.com/linkedin/rest.li/compare/v29.43.7...v29.43.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,27 @@ public DualReadStateManager(DualReadModeProvider dualReadModeProvider, Scheduled

public void updateGlobal(DualReadModeProvider.DualReadMode mode)
{
boolean updated = _dualReadMode != mode;
_dualReadMode = mode;
LOG.info("Global dual read mode updated: {}", mode);
if (updated) {
LOG.info("Global dual read mode updated: {}", mode);
}
}

public void updateService(String service, DualReadModeProvider.DualReadMode mode)
{
_serviceDualReadModes.put(service, mode);
LOG.info("Dual read mode for service {} updated: {}", service, mode);
DualReadModeProvider.DualReadMode oldMode = _serviceDualReadModes.put(service, mode);
if (oldMode != mode) {
LOG.info("Dual read mode for service {} updated: {}", service, mode);
}
}

public void updateCluster(String cluster, DualReadModeProvider.DualReadMode mode)
{
_clusterDualReadModes.put(cluster, mode);
LOG.info("Dual read mode for cluster {} updated: {}", cluster, mode);
DualReadModeProvider.DualReadMode oldMode = _clusterDualReadModes.put(cluster, mode);
Copy link
Contributor

@ZoabKapoor ZoabKapoor Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:til:

I didn't know that Map.put returns the original value if it was there!

if (oldMode != mode) {
LOG.info("Dual read mode for cluster {} updated: {}", cluster, mode);
}
}

public DualReadModeProvider.DualReadMode getGlobalDualReadMode()
Expand Down Expand Up @@ -173,7 +180,7 @@ public void checkAndSwitchMode(String d2ServiceName)
// Check and switch global dual read mode
updateGlobal(_dualReadModeProvider.getDualReadMode());

// Check and switch service-level dual read mode}
// Check and switch service-level dual read mode
if (d2ServiceName != null)
{
updateService(d2ServiceName, _dualReadModeProvider.getDualReadMode(d2ServiceName));
Expand Down
2 changes: 1 addition & 1 deletion d2/src/main/java/com/linkedin/d2/xds/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void startRpcStream()
AggregatedDiscoveryServiceGrpc.newStub(_managedChannel);
_adsStream = new AdsStream(stub);
_adsStream.start();
_log.info("ADS stream started");
_log.info("ADS stream started, connected to server: {}", _managedChannel.authority());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.43.10
version=29.43.11
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
Loading