hanahmily commented on code in PR #686: URL: https://github.com/apache/skywalking-banyandb/pull/686#discussion_r2165307399
########## banyand/liaison/grpc/property.go: ########## @@ -405,11 +411,73 @@ func (ps *propertyServer) Query(ctx context.Context, req *propertyv1.QueryReques return &propertyv1.QueryResponse{Properties: properties, Trace: trace}, nil } +func (ps *propertyServer) repairPropertyIfNeed(ctx context.Context, entity string, p *propertyWithCount, groups map[string]*commonv1.Group) error { + // make sure have the enough replicas + group := groups[p.Metadata.Group] + if group == nil { + return errors.Errorf("group %s not found", p.Metadata.Group) + } + copies, ok := ps.groupRepo.copies(p.Metadata.GetGroup()) + if !ok { + return errors.New("failed to get group copies") + } + if copies == uint32(len(p.existNodes)) { + return nil + } + id, err := partition.ShardID(convert.StringToBytes(entity), group.ResourceOpts.ShardNum) + if err != nil { + return err + } + // building the repair data + repairReq := &propertyv1.InternalRepairRequest{ShardId: uint64(id)} + if p.deletedTime > 0 { // building the delete request + repairReq.Operation = &propertyv1.InternalRepairRequest_Delete{ Review Comment: Other users may trigger additional writing during this process, making it impossible to guarantee that the data remains consistent after the query. It's important to remember that all data can change over time, which is why distributed operations can be challenging. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org