acs::Cluster method register_nodes (public)

 <instance of acs::Cluster[i]> register_nodes [ -startup ]

Defined in packages/acs-tcl/tcl/cluster-procs.tcl

Register the defined cluster nodes by creating/recreating cluster node objects.

Switches:
-startup (optional, defaults to "false")

Testcases:
No testcase defined.
Source code:
:log ":register_nodes startup $startup"

#
# Configure base configuration values
#
#
set dynamic_peers [:dynamic_cluster_nodes]

# At startup, when we are running on the canonical server,
# check, whether the existing dynamic cluster nodes are
# still reachable. When the canonical server is started
# before the other cluster nodes, this parameter should be
# empty. However, when the canonical server is restarted,
# there might be some of the peer nodes already active.
#
if {$startup
    && ${:current_server_is_canonical_server}
    && $dynamic_peers ne ""
} {
    #
    # When we are starting the canonical server, it resets
    # the potentially pre-existing dynamic nodes unless
    # these are reachable.
    #
    set old_peer_locations $dynamic_peers
    :log "canonical server starts with existing DynamicClusterPeers nodes: $old_peer_locations"
    #
    # Keep the reachable cluster nodes in
    # "DynamicClusterPeers".
    #
    set new_peer_locations {}
    foreach location $old_peer_locations {
        if {[:reachable $location]} {
            lappend new_peer_locations $location
        }
    }
    if {$new_peer_locations ne $old_peer_locations} {
        #
        # Update the DynamicClusterPeers in the database
        # such that the other nodes will pick it up as
        # well.
        #
        :log "updating DynamicClusterPeers to '$new_peer_locations' epoch [ns_ictl epoch]"
        parameter::set_value  -package_id $::acs::kernel_id  -parameter DynamicClusterPeers  -value [lsort $new_peer_locations]
        set dynamic_peers $new_peer_locations
    }
}

#
# Determine the peer nodes.
#
set cluster_peer_nodes [:peer_nodes $dynamic_peers]
nsv_set cluster cluster_peer_nodes $cluster_peer_nodes
#:log "cluster_peer_nodes <$cluster_peer_nodes>"

if {![:is_configured_server ${:myLocations}]} {
    #
    # Current node is not pre-registered.
    #
    ns_log notice "Current host ${:myLocation} is not included in ${:configured_cluster_hosts}"
    if {![:current_server_is_canonical_server]} {
        ns_log notice "... must join at canonical server ${:canonicalServerLocation}"
        :send_join_request_to_canonical_server
    }
} else {
    #ns_log notice "Current host ${:myLocation} is included in ${:configured_cluster_hosts}"
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: