Skip to content

Commit

Permalink
marklogic-community#703: added --legacy flag
Browse files Browse the repository at this point in the history
  • Loading branch information
grtjn committed Jun 7, 2017
1 parent 3aa8a69 commit deee678
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,10 @@ def execute_query(query, properties = {})
return r
end

def restart_group(group = nil)
def restart_group(group = nil, legacy = false)
logger.debug "group: #{group}"
logger.debug "legacy: #{legacy}"

if ! group
# Note:
# Restarting partial cluster is unsafe when working with multiple groups.
Expand All @@ -547,7 +550,7 @@ def restart_group(group = nil)
logger.info "Restarting MarkLogic Server group #{group}"
end

if @server_version > 7
if @server_version > 7 && !legacy
# MarkLogic 8+, make use of Management REST api and return details of all involved hosts

if group == "cluster"
Expand All @@ -572,7 +575,6 @@ def restart_group(group = nil)

old_timestamp = go(%Q{http://#{@properties["ml.server"]}:8001/admin/v1/timestamp}, "get").body

logger.debug "this: #{self}"
setup = File.read ServerConfig.expand_path("#{@@path}/lib/xquery/setup.xqy")
r = execute_query %Q{#{setup} setup:do-restart("#{group}")}
logger.debug "code: #{r.code.to_i}"
Expand Down Expand Up @@ -604,6 +606,11 @@ def get_host_names
def restart
# Default to verified restart
verify = find_arg(['--verify']) != 'false'
# Default to using Management Rest api (if available)
legacy = find_arg(['--legacy']) != nil

logger.debug "verify: #{verify}"
logger.debug "legacy: #{legacy}"

group = next_arg("^[^-]")

Expand All @@ -615,12 +622,12 @@ def restart
end

if ! verify
restart_group(group)
restart_group(group, legacy)
else
old_timestamps = restart_group(group)

host_names = get_host_names()

old_timestamps = restart_group(group, legacy)

# Iterate until all hosts have restarted (or max is reached)
old_timestamps.each do |host|
host_name = host_names[host['host-id']]
Expand Down

0 comments on commit deee678

Please sign in to comment.