Skip to content

Commit 2824e9a

Browse files
committed
Use PartitionAssignment Mbean since Service MBean count goes to 0 during rolling restart
1 parent c17b72c commit 2824e9a

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

operator/src/main/resources/scripts/stop-server.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def waitUntilCoherenceSafe():
116116
print ('Shutdown: getting all service Coherence MBeans')
117117

118118
domainRuntime()
119-
query='Coherence:type=Service,name=*,*'
119+
query='Coherence:type=PartitionAssignment,service=*,*'
120120

121121
# Wait forever until we get positive ack that it is ok to shutdown this server.
122122
done = False
@@ -133,7 +133,7 @@ def waitUntilCoherenceSafe():
133133
print ('Shutdown: It is safe to shutdown Coherence')
134134

135135
except:
136-
print ("Shutdown: Exception checking a service Coherence statusHA, retrying...")
136+
print ("Shutdown: Exception checking a service Coherence HAStatus, retrying...")
137137
traceback.print_exc(file=sys.stdout)
138138
dumpStack()
139139
systime.sleep(30)
@@ -144,36 +144,21 @@ def waitUntilCoherenceSafe():
144144
# If the cluster is a single node cluster then the service will always
145145
# be ENDANGERED, therefore it is the responsibility of the user to
146146
# set Coherence backup count to 0, or to set the terminate grace period
147-
# to a low number since this method will just wait until the oeprator kills the
147+
# to a low number since this method will just wait until the kubernetes kills the
148148
# pod.
149149
def waitUntilServiceSafeToShutdown(objectName):
150150

151-
print ("Shutdown: checking Coherence service " + str(objectName) )
151+
print ("Shutdown: checking Coherence service " + str(objectName))
152152

153153
# NOTE: break loop when it safe to shutdown else stay in loop forever
154154
while (True):
155155
try:
156-
# If the BackupCount is > 0 then the user intention is to have
157-
# HA with backed up partitions, otherwise if value is < 1 then the user
158-
# doesn't care about HA so no need to wait.
159-
# NOTE: if this is NOT a partitioned service we will get exception, ignore and exit loop
160-
try:
161-
val = mbs.getAttribute(objectName,"BackupCount")
162-
except:
163-
print ("Shutdown: Coherence BackupCount attribute missing")
164-
val = None
165-
pass
166-
167-
if (val is None) or int(val) < 1:
168-
print ("Shutdown: Coherence skipping status check for this service since BackupCount < 1. Value is " + str(val))
169-
break
170-
171-
status = mbs.getAttribute(objectName,"StatusHA")
156+
status = mbs.getAttribute(objectName,"HAStatus")
172157
if (status is None):
173-
print ("Shutdown: None returned for Coherence StatusHA")
158+
print ("Shutdown: None returned for Coherence HAStatus")
174159
break
175160

176-
print ('Shutdown: Coherence StatusHA is ' + status)
161+
print ('Shutdown: Coherence HAStatus is ' + status)
177162
if status != "ENDANGERED":
178163
break
179164

0 commit comments

Comments
 (0)