Skip to content

raftRequest is a trivial wrapper around raftRequestOnce — callers split arbitrarily #21515

@aalpar

Description

@aalpar

raftRequest at server/etcdserver/v3_server.go:894 is a one-liner that delegates to raftRequestOnce:

func (s *EtcdServer) raftRequest(ctx context.Context, r pb.InternalRaftRequest) (proto.Message, error) {
	return s.raftRequestOnce(ctx, r)
}

The two functions are identical, but callers are split between them with no clear pattern:

Direct raftRequestOnce (7 callers): LeaseGrant, LeaseRevoke, Alarm, AuthEnable, Authenticate, NewServer, raftRequest itself

Via raftRequest wrapper (24 callers): Put, DeleteRange, Txn, AuthDisable, AuthStatus, all User*/Role* methods, DowngradeEnable, DowngradeCancel, and others

The naming suggests raftRequest once had retry logic around raftRequestOnce, but currently the wrapper is dead code. This creates unnecessary confusion about which to call — e.g., AuthEnable uses raftRequestOnce while its sibling AuthDisable uses raftRequest.

Suggested cleanup: Inline raftRequest (replace its 24 callers with raftRequestOnce) or vice versa, eliminating the dead indirection and the arbitrary split.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions