Fixed part of the dynamic configuration of ConfigurationDiscoveryService that does not take effect under certain circumstances. (#6975)

This commit is contained in:
zifeihan 2021-05-20 07:52:49 +08:00 committed by GitHub
parent 8c23752c6d
commit 97c42d2f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Release Notes.
* Fix NPE when thrift field is nested in plugin `thrift`
* Fix possible NullPointerException in agent's ES plugin.
* Fix the conversion problem of float type in ConfigInitializer.
* Fixed part of the dynamic configuration of ConfigurationDiscoveryService that does not take effect under certain circumstances.
#### OAP-Backend
* BugFix: filter invalid Envoy access logs whose socket address is empty.

View File

@ -62,6 +62,8 @@ public class ConfigurationDiscoveryService implements BootService, GRPCChannelLi
private String uuid;
private final Register register = new Register();
private volatile int lastRegisterWatcherSize;
private volatile ScheduledFuture<?> getDynamicConfigurationFuture;
private volatile GRPCChannelStatus status = GRPCChannelStatus.DISCONNECT;
private volatile ConfigurationDiscoveryServiceGrpc.ConfigurationDiscoveryServiceBlockingStub configurationDiscoveryServiceBlockingStub;
@ -206,6 +208,15 @@ public class ConfigurationDiscoveryService implements BootService, GRPCChannelLi
try {
ConfigurationSyncRequest.Builder builder = ConfigurationSyncRequest.newBuilder();
builder.setService(Config.Agent.SERVICE_NAME);
// Some plugin will register watcher later.
final int size = register.keys().size();
if (lastRegisterWatcherSize != size) {
// reset uuid, avoid the same uuid causing the configuration not to be updated.
uuid = null;
lastRegisterWatcherSize = size;
}
if (null != uuid) {
builder.setUuid(uuid);
}