wu-sheng commented on a change in pull request #3170: Support upgrade backend 
w/o rebooting agents
URL: https://github.com/apache/skywalking/pull/3170#discussion_r308042747
 
 

 ##########
 File path: 
oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/ServiceInstancePingServiceHandler.java
 ##########
 @@ -57,11 +61,21 @@ public ServiceInstancePingServiceHandler(ModuleManager 
moduleManager) {
         ServiceInstanceInventory serviceInstanceInventory = 
serviceInstanceInventoryCache.get(serviceInstanceId);
         if (Objects.nonNull(serviceInstanceInventory)) {
             
serviceInventoryRegister.heartbeat(serviceInstanceInventory.getServiceId(), 
heartBeatTime);
+            responseObserver.onNext(Commands.getDefaultInstance());
         } else {
-            logger.warn("Can't found service by service instance id from 
cache, service instance id is: {}", serviceInstanceId);
+            logger.warn("Can't found service by service instance id from 
cache," +
+                " service instance id is: {}, will send a reset command to 
agent side", serviceInstanceId);
+            final String serialNumber = generateSerialNumber(request);
+            final Command resetCommand = new 
ServiceResetCommand(serialNumber).serialize().build();
+            final Commands nextCommands = 
Commands.newBuilder().addCommands(resetCommand).build();
+            responseObserver.onNext(nextCommands);
         }
 
-        responseObserver.onNext(Commands.getDefaultInstance());
         responseObserver.onCompleted();
     }
+
+    // Simply generate a uuid without taking care of the {@code request}
+    private String generateSerialNumber(final ServiceInstancePingPkg request) {
 
 Review comment:
   Following above, this method should be moved into core too.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to