File: collection_rebalanceleaders.R

package info (click to toggle)
r-cran-solrium 1.1.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,132 kB
  • sloc: xml: 374; sh: 13; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,683 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#' @title Rebalance leaders
#'
#' @description Reassign leaders in a collection according to the preferredLeader
#' property across active nodes
#'
#' @export
#' @inheritParams collection_create
#' @param maxAtOnce (integer) The maximum number of reassignments to have queue
#' up at once. Values <=0 are use the default value Integer.MAX_VALUE. When
#' this number is reached, the process waits for one or more leaders to be
#' successfully assigned before adding more to the queue.
#' @param maxWaitSeconds (integer) Timeout value when waiting for leaders to
#' be reassigned. NOTE: if maxAtOnce is less than the number of reassignments
#' that will take place, this is the maximum interval that any single wait for
#' at least one reassignment. For example, if 10 reassignments are to take
#' place and maxAtOnce is 1 and maxWaitSeconds is 60, the upper bound on the
#' time that the command may wait is 10 minutes. Default: 60
#' @examples \dontrun{
#' (conn <- SolrClient$new())
#'
#' # create collection
#' if (!conn$collection_exists("mycollection2")) {
#'   conn$collection_create(name = "mycollection2")
#'   # OR: bin/solr create -c mycollection2
#' }
#'
#' # balance preferredLeader property
#' conn$collection_balanceshardunique("mycollection2", property = "preferredLeader")
#'
#' # balance preferredLeader property
#' conn$collection_rebalanceleaders("mycollection2")
#'
#' # examine cluster status
#' conn$collection_clusterstatus()$cluster$collections$mycollection2
#' }
collection_rebalanceleaders <- function(conn, name, maxAtOnce = NULL,
  maxWaitSeconds = NULL, raw = FALSE, ...) {

  conn$collection_rebalanceleaders(name, maxAtOnce, maxWaitSeconds, raw, ...)
}