The addresses belong to the connection, not to this list. A GPUdb instance discovers each cluster’s rank addresses, applies the connection’s hostname regex to them, and keeps the result per cluster; this class is a view onto that, held by a BulkInserter or RecordRetriever.
It does not resolve or filter addresses of its own. A filter has no coherent meaning here, because it cannot survive a failover: one tuned for a cluster’s addressing may match nothing on the next, and multi-head objects fail over with the connection. Set the regex on the connection instead, where it is applied to every cluster as that cluster is discovered.
The one choice that is meaningful per object is declining multi-head altogether — see WorkerList(). That names an intent rather than an address, and an intent transfers across clusters where a list of addresses does not.
Note entry i of this list is rank i + 1; the head rank is not a member, and a rank removed from the cluster keeps its slot as null. The worker indices in the shard routing table are rank numbers, so compacting the list would silently misroute every rank above the hole.
Field Summary
Fields inherited from class java.util.AbstractList
modCountConstructor Summary
ConstructorsConstructorDescriptionCreates an emptyWorkerList, which declines multi-head operations for theBulkInserterorRecordRetrieverit is given to.WorkerList(GPUdb gpudb) Creates aWorkerListfrom the worker rank addresses the given connection has already discovered for the cluster it is currently on.WorkerList(GPUdb gpudb, String ipPrefix) Deprecated.WorkerList(GPUdb gpudb, Pattern ipRegex) Deprecated.the regex is ignored.WorkerList(List<URL> urls) Deprecated.for internal use.Method Summary
Modifier and TypeMethodDescriptionDeprecated.a worker list has no regex of its own.booleanWhether multi-head operations can be used with this list.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
Constructor Details
WorkerList
public WorkerList()Creates an emptyWorkerList, which declines multi-head operations for theBulkInserterorRecordRetrieverit is given to.That object will route through the head node for its lifetime. The choice is authoritative: it is not undone when the worker list is rebuilt after a failover or a shard rebalance.
This is the way to decline multi-head for a single object while keeping the connection’s fail-over. Disabling auto-discovery is not equivalent — it also stops the client discovering the other clusters in an HA ring, so it costs fail-over as well.
Nothing inside the API may use this constructor: it is a caller’s way of expressing an intent, and an internal use would silently pin its own list to head-node-only.
WorkerList
Deprecated.for internal use. Passnullto aBulkInserterorRecordRetrieverto use the connection’s own addresses, orWorkerList()to decline multi-head.Creates aWorkerListpopulated with the given URLs.The list is honored as given, but is not maintained: after the connection fails over or back, the object adopts that cluster’s addresses instead, because a list of one cluster’s rank addresses says nothing about another’s.
Parameters:urls- the worker rank URLs, withnullin the slot of any rank removed from the clusterWorkerList
Creates aWorkerListfrom the worker rank addresses the given connection has already discovered for the cluster it is currently on.This reads the connection’s addresses; it does not query the server or re-resolve them. They were filtered through the connection’s hostname regex when that cluster was discovered, so they already reflect it.
If the connection has no worker addresses for the current cluster — multi-head is off at the server, or the cluster advertises none this client can use — the list is empty and the object using it operates through the head node.
Parameters:gpudb- theGPUdbinstance whose addresses to useThrows:GPUdbException- never thrown; retained for source compatibilityWorkerList
Deprecated.the regex is ignored. Address filtering belongs on the connection — seeGPUdbBase.Options.setHostnameRegex(java.lang.String)— because a filter at this scope cannot survive a failover: one tuned for a cluster’s addressing may match nothing on the next. This constructor behaves asWorkerList(GPUdb).Parameters:gpudb- theGPUdbinstance whose addresses to useipRegex- ignoredThrows:GPUdbException- never thrown; retained for source compatibilityWorkerList
Deprecated.the prefix is ignored; seeWorkerList(GPUdb, Pattern)for why, andGPUdbBase.Options.setHostnameRegex(java.lang.String)for the replacement.Parameters:gpudb- theGPUdbinstance whose addresses to useipPrefix- ignoredThrows:GPUdbException- never thrown; retained for source compatibility
Method Details
getIpRegex
Deprecated.a worker list has no regex of its own. Addresses are filtered by the connection; seeGPUdbBase.Options.getHostnameRegex().Returns:alwaysnullisMultiHeadEnabled
public boolean isMultiHeadEnabled()Whether multi-head operations can be used with this list.Returns:whether the list names any worker rank
WorkerList(GPUdb, Pattern)for why, andGPUdbBase.Options.setHostnameRegex(java.lang.String)for the replacement.