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

Ensure locking patterns don't prevent parallel requests #24

Merged
merged 3 commits into from Oct 14, 2021

Conversation

fairclothjm
Copy link
Contributor

Description

Allow Create, Update and Delete operations to be performed in parallel.

This PR fixes an issue in which the locking pattern did not allow parallel requests. The lease revocations were being performed sequentially which would block until completion. This would eventually exceed the default timeout of 90s, causing lease revocations to fail with err: failed to make connection: error in Connection waiting for cluster: unambiguous timeout. Additionally, this could block concurrent Create and Update operations.

Manual test

  • cd to couchbase plugin dir
    • checkout this branch
    • make dev
  • then run the test script
  • observe the lease revocations are completed and there are no read errors
test script
#!/usr/bin/env bash

set -e

docker run \
  --name couchbase-server \
  --publish 8091-8094:8091-8094 \
  --publish 11210-11211:11210-11211 \
  --detach \
  --rm \
  couchbase/server-sandbox:6.5.0

docker ps -f name=couchbase-server --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"

vault write database/config/cb \
  plugin_name="couchbase" \
  hosts="localhost" \
  username="Administrator" \
  password="password" \
  allowed_roles="role*"

echo "===> Create roles for testing..."

for i in {1..10}; do
  vault write database/roles/role${i} \
    db_name=cb \
    default_ttl="30s" \
    max_ttl="30s"
done

echo "===> Create numerous new credentials..."

read_creds() {
  for i in {1..10}; do
    vault read database/creds/role${i} > /dev/null
  done
}

for r in {1..100}; do
  echo -n "${r} "
  read_creds "$r"
done

vault lease revoke -prefix database/creds

@jasonodonnell jasonodonnell self-requested a review October 13, 2021 20:40
@fairclothjm fairclothjm merged commit a10c142 into main Oct 14, 2021
@fairclothjm fairclothjm deleted the vault-3469-lease-revocations branch October 14, 2021 14:40
fairclothjm added a commit to hashicorp/vault that referenced this pull request Nov 3, 2021
fairclothjm added a commit to hashicorp/vault that referenced this pull request Nov 3, 2021
* Add changelog for hashicorp/vault-plugin-database-couchbase#24

* update changelog name

* remove debug line
fairclothjm added a commit to hashicorp/vault that referenced this pull request Nov 3, 2021
* Add changelog for hashicorp/vault-plugin-database-couchbase#24

* update changelog name

* remove debug line
fairclothjm added a commit to hashicorp/vault that referenced this pull request Nov 9, 2021
qk4l pushed a commit to qk4l/vault that referenced this pull request Feb 4, 2022
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.

None yet

3 participants