From fbd8f868a124af47d1c91b742d587c4fab6f2a32 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 14 Jul 2022 12:15:31 -0700 Subject: [PATCH] filer may have trouble to re-connect clientId is used twice: one for local metadata subscription, one for combined metadata subscription. --- weed/server/filer_grpc_server_sub_meta.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/server/filer_grpc_server_sub_meta.go b/weed/server/filer_grpc_server_sub_meta.go index 745379e7c..6a4a5bb17 100644 --- a/weed/server/filer_grpc_server_sub_meta.go +++ b/weed/server/filer_grpc_server_sub_meta.go @@ -90,6 +90,9 @@ func (fs *FilerServer) SubscribeLocalMetadata(req *filer_pb.SubscribeMetadataReq peerAddress := findClientAddress(stream.Context(), 0) + // use negative client id to differentiate from addClient()/deleteClient() used in SubscribeMetadata() + req.ClientId = -req.ClientId + alreadyKnown, clientName := fs.addClient(req.ClientName, peerAddress, req.ClientId) if alreadyKnown { return fmt.Errorf("duplicated local subscription detected for client %s id %d", clientName, req.ClientId)