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

Commit 618ddb2

Browse files
authored
Merge pull request #761 from divino/Issue-703
Fix #703
2 parents 427d548 + d14fcd4 commit 618ddb2

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

deploy/default.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,9 @@ http.retry-count=3
260260
http.open-timeout=5
261261
http.read-timeout=300
262262
http.retry-delay=15
263+
264+
#
265+
# Verified restart config
266+
#
267+
verify_retry_max=5
268+
verify_retry_interval=10

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 = @properties["ml.verify_retry_max"].to_i
570+
retry_interval = @properties["ml.verify_retry_interval"].to_i
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
@@ -1175,9 +1175,9 @@ declare function setup:do-restart($group-name as xs:string?) as item()*
11751175
"Restarting hosts to make configuration changes take effect"),
11761176

11771177
if ($group-id) then
1178-
fn:concat("Group ", $group-name, " restarted")
1178+
fn:concat("Invoked group ", $group-name, " restart")
11791179
else
1180-
fn:concat("Cluster restarted")
1180+
fn:concat("Invoked cluster restart")
11811181
)
11821182
}
11831183
catch ($ex)

0 commit comments

Comments
 (0)