Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 177365f

Browse files
committed
implemented verified restart
1 parent 7bc489b commit 177365f

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

deploy/lib/server_config.rb

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def execute_query(query, properties = {})
520520
return r
521521
end
522522

523-
def restart
523+
def restart_basic
524524
@ml_username = @properties['ml.bootstrap-user'] || @properties['ml.user']
525525
if @ml_username == @properties['ml.bootstrap-user']
526526
@ml_password = @properties['ml.bootstrap-password']
@@ -556,6 +556,43 @@ def restart
556556
return true
557557
end
558558

559+
# implemented verified restart
560+
def restart
561+
verify = find_arg(['--verify'])
562+
if verify==='false'
563+
restart_basic
564+
else
565+
# defaults to verified restart
566+
old_timestamp = go(%Q{http://#{@properties["ml.server"]}:8001/admin/v1/timestamp}, "get").body
567+
restart_basic
568+
retry_count = 0
569+
retry_max = 5
570+
retry_interval= 10
571+
new_timestamp = old_timestamp
572+
while retry_count < retry_max do
573+
begin
574+
new_timestamp = go(%Q{http://#{@properties["ml.server"]}:8001/admin/v1/timestamp}, "get").body
575+
rescue
576+
logger.info 'Verifying restart ...'
577+
logger.debug 'Retry attempt ' + retry_count.to_s + ' failed'
578+
end
579+
if new_timestamp != old_timestamp
580+
# indicates that restart is confirmed successful
581+
break
582+
end
583+
logger.debug "Verifying restart..."
584+
sleep retry_interval
585+
retry_count += 1
586+
end
587+
if new_timestamp == old_timestamp
588+
logger.warn "Could not verify restart"
589+
else
590+
logger.info 'Verified restart.'
591+
logger.debug "Verified restart new #{new_timestamp} old #{old_timestamp}"
592+
end
593+
end
594+
end
595+
559596
def merge
560597
what = ARGV.shift
561598
raise HelpException.new("merge", "Missing WHAT") unless what

deploy/lib/xquery/setup.xqy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,9 +1170,9 @@ declare function setup:do-restart($group-name as xs:string?) as item()*
11701170
"Restarting hosts to make configuration changes take effect"),
11711171

11721172
if ($group-id) then
1173-
fn:concat("Group ", $group-name, " restarted")
1173+
fn:concat("Invoked group ", $group-name, " restart")
11741174
else
1175-
fn:concat("Cluster restarted")
1175+
fn:concat("Invoked cluster restart")
11761176
)
11771177
}
11781178
catch ($ex)

0 commit comments

Comments
 (0)