Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a role cache to avoid separate locking paths #6926

Merged
merged 5 commits into from
Jun 20, 2019
Merged

Conversation

jefferai
Copy link
Member

Due to the various locked/nonlocked paths we had a case where we weren't
always checking for secondary status before trying to upgrade. This
broadly simplifies things by using a cache to store the current role
values (avoiding a lot of storage hits) and updating the cache on any
write, delete, or invalidation.

Due to the various locked/nonlocked paths we had a case where we weren't
always checking for secondary status before trying to upgrade. This
broadly simplifies things by using a cache to store the current role
values (avoiding a lot of storage hits) and updating the cache on any
write, delete, or invalidation.
Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. The tests that have been added are passing. I do see a test failure in the aws credential plugin directory, but it appears unrelated:

--- FAIL: TestBackendAcc_LoginWithCallerIdentity (2.42s)
    backend_test.go:1564: bad: failed to create role: resp:&logical.Response{Secret:<nil>, Auth:<nil>, Data:map[string]interface {}{"error":"unable to resolve ARN \"arn:aws:iam::047646243813:user/tbex\" to internal ID: InvalidClientTokenId: The security token included in the request is invalid\n\tstatus code: 403, request id: 46f88dbd-92de-11e9-ba31-51c4e4fb1518"}, Redirect:"", Warnings:[]string(nil), WrapInfo:(*wrapping.ResponseWrapInfo)(nil), Headers:map[string][]string(nil)}
        err:<nil>

I haven't been able to verify yet if this failure also occurs on master because it's not part of automated tests.

@jefferai
Copy link
Member Author

Yeah that seems unrelated.

@catsby
Copy link
Contributor

catsby commented Jun 20, 2019

TestBackendAcc_LoginWithCallerIdentity

This test passes for me:

[vault][aws-role-cache](4)$ make testacc TEST=./builtin/credential/aws TESTARGS="-run=TestBackendAcc_LoginWithCallerIdentity"
==> Checking that build is using go version >= 1.11...
==> Using go version 1.12.6...
VAULT_ACC=1 go test -tags='' ./builtin/credential/aws -v -run=TestBackendAcc_LoginWithCallerIdentity -timeout=45m
=== RUN   TestBackendAcc_LoginWithCallerIdentity
--- PASS: TestBackendAcc_LoginWithCallerIdentity (3.03s)
PASS
ok      github.com/hashicorp/vault/builtin/credential/aws       3.262s

@jefferai jefferai merged commit 4ff9001 into master Jun 20, 2019
@jefferai jefferai deleted the aws-role-cache branch June 20, 2019 14:33
@jefferai jefferai added this to the 1.1.4 milestone Jun 20, 2019
jefferai added a commit that referenced this pull request Jun 20, 2019
* Use a role cache to avoid separate locking paths

Due to the various locked/nonlocked paths we had a case where we weren't
always checking for secondary status before trying to upgrade. This
broadly simplifies things by using a cache to store the current role
values (avoiding a lot of storage hits) and updating the cache on any
write, delete, or invalidation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants