acs::Cluster method dynamic_cluster_reconfigure (public)

 <instance of acs::Cluster[i]> dynamic_cluster_reconfigure operation \
    qualifiedLocation

Defined in

Reconfigure the cluster via "join" or "disconnect" operation, when running on the canonical server. The result of the reconfiguration is a changed list of DynamicClusterPeers. The method returns a boolean value indicating success.

Parameters:
operation (required)
qualifiedLocation (required)

Testcases:
No testcase defined.
Source code:
ns_log notice "Cluster reconfigure $operation from '$qualifiedLocation'"

set success 1
#
# To be ultra-conservative, we could allow cluster
# reconfigure operations only on the canonical
# server. This would require also to alter the
# acs-admin/cluster page to show the trash icon only when
# the page is executed on the canonical server.
#
if {0 && ![:current_server_is_canonical_server]} {
    ns_log warning "Cluster reconfigure rejected,"  "since it was received by a non-canonical server"
    set success 0
} else {
    #
    # We know, we are running on the canonical server, and
    # we know that the request is trustworthy.
    #
    ns_log notice "Cluster reconfigure $qualifiedLocation accepted from $qualifiedLocation"
    set dynamicClusterNodes [:dynamic_cluster_nodes]
    switch $operation {
        "join" {
            set dynamicClusterNodes  [lsort -unique [concat $dynamicClusterNodes $qualifiedLocation]]
        }
        "disconnect" {
            set dynamicClusterNodes  [lsearch -inline -all -not -exact $dynamicClusterNodes $qualifiedLocation]
        }
        default {
            ns_log warning "Cluster reconfigure rejected,"  "received invalid operation '$operation'"
            return 0
        }
    }
    #
    # The parameter::set_value operation causes a
    # clusterwide cache-flush for the parameters
    #
    parameter::set_value  -package_id $::acs::kernel_id  -parameter DynamicClusterPeers  -value $dynamicClusterNodes
    ns_log notice "[self] reconfigure $operation leads to DynamicClusterPeers $dynamicClusterNodes"
}
return $success
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: