{"record":{"id":"6022f6841e66b1fa","repo":"dgraph-io/dgraph","slug":"failed-to-send-data-to-majority-of-the-nodes","errorCode":null,"errorMessage":"failed to send data to majority of the nodes","messagePattern":"failed to send data to majority of the nodes","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"worker/import.go","lineNumber":639,"sourceCode":"\t\t}\n\t\treturn nil\n\t})\n\n\tif err := eg.Wait(); err != nil {\n\t\treturn fmt.Errorf(\"failed to run in group streaming: %v\", err)\n\t}\n\t// Sends a StreamExtSnapshotResponse with the Finish flag set to true to indicate\n\t// the completion of the streaming process. If an error occurs during the send\n\t// operation, it is returned for further handling.\n\tif err := stream.Send(&api.StreamExtSnapshotResponse{Finish: true}); err != nil {\n\t\tglog.Errorf(\"failed to send done signal: %v\", err)\n\t}\n\n\t// If this node is the leader and fails to reach a majority of nodes, we return an error.\n\t// This ensures that the data is reliably received by enough nodes before proceeding.\n\tif forward && !checkMajority(successfulNodes) {\n\t\tglog.Error(\"[import] Majority of nodes failed to receive data.\")\n\t\treturn fmt.Errorf(\"failed to send data to majority of the nodes\")\n\t}\n\treturn nil\n}\n\nfunc updateNodeStatus(ps *sync.RWMutex, successfulNodes map[string]bool, addr string, status bool) {\n\tps.Lock()\n\tsuccessfulNodes[addr] = status\n\tps.Unlock()\n}\n\n// Calculate majority based on Raft quorum rules with special handling for small clusters\nfunc checkMajority(successfulNodes map[string]bool) bool {\n\ttotalNodes := len(successfulNodes)\n\tsuccessfulCount := 0\n\n\tfor _, success := range successfulNodes {\n\t\tif success {\n\t\t\tsuccessfulCount++","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/import.go#L621-L657","documentation":"When a leader forwards the external snapshot to its group members (forward=true), each member's success is tracked in successfulNodes. After the stream completes, checkMajority applies Raft quorum rules; if fewer than a majority of members received the data, the leader rejects the snapshot with this error to guarantee durability.","triggerScenarios":"More than half of the group's members failed during forwarding — peers dead (member.AmDead), connection pool errors, failed peer streams, or local subscriber errors — while forward=true.","commonSituations":"Running a snapshot import while one or more replicas are down or network-partitioned; replicas marked dead in Zero membership; firewall between alphas blocking the internal gRPC port (7080).","solutions":["Bring failed replicas back online (check Zero membership state, restart dead alphas) and retry the import.","Verify internal gRPC (port 7080) connectivity between all group members.","Ensure the group has enough healthy members for quorum (e.g. at least 2 of 3) before importing.","Check replication factor / number of replicas in the group; with a single replica quorum always requires it to succeed.","Remove or repair permanently dead replicas so the alive members form a majority."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// before import: ensure quorum is possible\nalive := countAliveMembers(gid)\nif alive*2 <= totalMembers(gid) {\n    return errors.New(\"cannot import: group lacks quorum; repair replicas first\")\n}","typeGuard":null,"tryCatchPattern":"err := streamSnapshot(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to send data to majority\") {\n    // restart/repair dead replicas, then retry the import\n}","preventionTips":["Never run snapshot imports with replicas down; repair quorum first","Monitor Zero membership (member.AmDead flags) before bulk operations","Keep internal port 7080 open between all alphas","Use replication factor >= 3 so one failure still leaves a majority"],"tags":["quorum","raft","distributed-systems","replication","import"],"backgroundTag":"quorum-not-reached","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}