Browse Source

Backport of fix: clarifying error message when acquiring a lock in remote dc into release/1.14.x (#15415)

This pull request was automerged via backport-assistant
pull/15415/merge
hc-github-team-consul-core 2 years ago committed by GitHub
parent
commit
2de3b807d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      agent/session_endpoint.go
  2. 2
      website/content/commands/lock.mdx

4
agent/session_endpoint.go

@ -47,6 +47,10 @@ func (s *HTTPHandlers) SessionCreate(resp http.ResponseWriter, req *http.Request
fixupEmptySessionChecks(&args.Session)
if (s.agent.config.Datacenter != args.Datacenter) && (!s.agent.config.ServerMode) {
return nil, fmt.Errorf("cross datacenter lock must be created at server agent")
}
// Create the session, get the ID
var out string
if err := s.agent.RPC("Session.Apply", &args, &out); err != nil {

2
website/content/commands/lock.mdx

@ -24,6 +24,8 @@ If the lock holder count is more than one, then a semaphore is used instead.
A semaphore allows more than a single holder, but this is less efficient than
a simple lock. This follows the [semaphore algorithm](https://learn.hashicorp.com/consul/developer-configuration/semaphore).
To apply a lock to a remote WAN federated datacenter, run the command with the `-datacenter=<name>` flag on a server agent. You cannot use the command with `-datacenter` on client agents because they are unavailable to the remote datacenter.
All locks using the same prefix must agree on the value of `-n`. If conflicting
values of `-n` are provided, an error will be returned.

Loading…
Cancel
Save