ACL RPCs allow stale reads for scalability

This commit is contained in:
Armon Dadgar 2017-08-24 09:53:30 -07:00
parent 31b39f8a71
commit b8bf35f087
2 changed files with 18 additions and 10 deletions

View File

@ -124,8 +124,11 @@ func (c *Client) resolveTokenValue(secretID string) (*structs.ACLToken, error) {
// Lookup the token
req := structs.ResolveACLTokenRequest{
SecretID: secretID,
QueryOptions: structs.QueryOptions{Region: c.Region()},
SecretID: secretID,
QueryOptions: structs.QueryOptions{
Region: c.Region(),
AllowStale: true,
},
}
var resp structs.ResolveACLTokenResponse
if err := c.RPC("ACL.ResolveToken", &req, &resp); err != nil {
@ -186,8 +189,9 @@ func (c *Client) resolvePolicies(secretID string, policies []string) ([]*structs
req := structs.ACLPolicySetRequest{
Names: fetch,
QueryOptions: structs.QueryOptions{
Region: c.Region(),
SecretID: secretID,
Region: c.Region(),
SecretID: secretID,
AllowStale: true,
},
}
var resp structs.ACLPolicySetResponse

View File

@ -674,7 +674,8 @@ REMOVE:
func (s *Server) replicateACLPolicies(stopCh chan struct{}) {
req := structs.ACLPolicyListRequest{
QueryOptions: structs.QueryOptions{
Region: s.config.AuthoritativeRegion,
Region: s.config.AuthoritativeRegion,
AllowStale: true,
},
}
limiter := rate.NewLimiter(replicationRateLimit, int(replicationRateLimit))
@ -720,8 +721,9 @@ START:
req := structs.ACLPolicySetRequest{
Names: update,
QueryOptions: structs.QueryOptions{
Region: s.config.AuthoritativeRegion,
SecretID: s.ReplicationToken(),
Region: s.config.AuthoritativeRegion,
SecretID: s.ReplicationToken(),
AllowStale: true,
},
}
var reply structs.ACLPolicySetResponse
@ -816,7 +818,8 @@ func (s *Server) replicateACLTokens(stopCh chan struct{}) {
req := structs.ACLTokenListRequest{
GlobalOnly: true,
QueryOptions: structs.QueryOptions{
Region: s.config.AuthoritativeRegion,
Region: s.config.AuthoritativeRegion,
AllowStale: true,
},
}
limiter := rate.NewLimiter(replicationRateLimit, int(replicationRateLimit))
@ -862,8 +865,9 @@ START:
req := structs.ACLTokenSetRequest{
AccessorIDS: update,
QueryOptions: structs.QueryOptions{
Region: s.config.AuthoritativeRegion,
SecretID: s.ReplicationToken(),
Region: s.config.AuthoritativeRegion,
SecretID: s.ReplicationToken(),
AllowStale: true,
},
}
var reply structs.ACLTokenSetResponse