A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/github/vulcanizer/commit/d2dba4b754848f0b74e81ba994f1ece1ead7003b below:

Allocate stale primary shard functionality is added · github/vulcanizer@d2dba4b · GitHub

@@ -227,11 +227,11 @@ type ClusterSettings struct {

227 227

// A setting name and value with the setting name to be a "collapsed" version of

228 228

// the setting. A setting of:

229 229

//

230 -

// { "indices": { "recovery" : { "max_bytes_per_sec": "10mb" } } }

230 +

// { "indices": { "recovery" : { "max_bytes_per_sec": "10mb" } } }

231 231

//

232 232

// would be represented by:

233 233

//

234 -

// ClusterSetting{ Setting: "indices.recovery.max_bytes_per_sec", Value: "10mb" }

234 +

// ClusterSetting{ Setting: "indices.recovery.max_bytes_per_sec", Value: "10mb" }

235 235

type Setting struct {

236 236

Setting string

237 237

Value string

@@ -1606,3 +1606,55 @@ func (c *Client) ClusterAllocationExplain(req *ClusterAllocationExplainRequest,

1606 1606 1607 1607

return string(body), nil

1608 1608

}

1609 + 1610 +

type RerouteRequest struct {

1611 +

// The commands to perform (move, cancel, allocate, etc)

1612 +

Commands []RerouteCommand `json:"commands,omitempty"`

1613 +

}

1614 + 1615 +

type RerouteCommand struct {

1616 +

AllocateStalePrimary AllocateStalePrimary `json:"allocate_stale_primary,omitempty"`

1617 +

}

1618 + 1619 +

type AllocateStalePrimary struct {

1620 +

// The node ID or node name of the node to assign the shard to.

1621 +

Node string `json:"node,omitempty"`

1622 + 1623 +

// The name of the index containing the shard to be assigned.

1624 +

Index string `json:"index,omitempty"`

1625 + 1626 +

// The shard ID of the shard to be assigned.

1627 +

Shard *int `json:"shard,omitempty"`

1628 + 1629 +

// If a node which has the good copy of the data rejoins the cluster later on, that data will be deleted or overwritten with the data of the stale copy that was forcefully allocated with this command.

1630 +

AcceptDataLoss bool `json:"accept_data_loss,omitempty"`

1631 +

}

1632 + 1633 +

// AllocateStalePrimary allows to manually allocate a stale primary shard to a specific node

1634 +

func (c *Client) AllocateStalePrimaryShard(node, index string, shard int) error {

1635 +

var urlBuilder strings.Builder

1636 +

urlBuilder.WriteString("_cluster/reroute")

1637 + 1638 +

agent := c.buildPostRequest(urlBuilder.String())

1639 + 1640 +

req := RerouteRequest{

1641 +

Commands: []RerouteCommand{

1642 +

{

1643 +

AllocateStalePrimary: AllocateStalePrimary{

1644 +

Node: node,

1645 +

Index: index,

1646 +

Shard: &shard,

1647 +

AcceptDataLoss: true,

1648 +

},

1649 +

},

1650 +

},

1651 +

}

1652 +

agent.Set("Content-Type", "application/json").Send(req)

1653 + 1654 +

_, err := handleErrWithBytes(agent)

1655 +

if err != nil {

1656 +

return err

1657 +

}

1658 + 1659 +

return nil

1660 +

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4