Skip to content

Commit

Permalink
Added info logs for system service units
Browse files Browse the repository at this point in the history
  • Loading branch information
heesung-sn committed May 16, 2023
1 parent 56aebdb commit 55aabce
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1193,15 +1193,15 @@ private synchronized void doCleanup(String broker) {
int orphanServiceUnitCleanupCnt = 0;
long totalCleanupErrorCntStart = totalCleanupErrorCnt.get();

Map<String, ServiceUnitStateData> orphanSystemBundles = new HashMap<>();
Map<String, ServiceUnitStateData> orphanSystemServiceUnits = new HashMap<>();
for (var etr : tableview.entrySet()) {
var stateData = etr.getValue();
var serviceUnit = etr.getKey();
var state = state(stateData);
if (StringUtils.equals(broker, stateData.dstBroker())) {
if (isActiveState(state)) {
if (serviceUnit.startsWith(SYSTEM_NAMESPACE.toString())) {
orphanSystemBundles.put(serviceUnit, stateData);
orphanSystemServiceUnits.put(serviceUnit, stateData);
} else {
overrideOwnership(serviceUnit, stateData, broker);
}
Expand All @@ -1211,7 +1211,7 @@ private synchronized void doCleanup(String broker) {
} else if (StringUtils.equals(broker, stateData.sourceBroker())) {
if (isInFlightState(state)) {
if (serviceUnit.startsWith(SYSTEM_NAMESPACE.toString())) {
orphanSystemBundles.put(serviceUnit, stateData);
orphanSystemServiceUnits.put(serviceUnit, stateData);
} else {
overrideOwnership(serviceUnit, stateData, broker);
}
Expand All @@ -1234,8 +1234,9 @@ private synchronized void doCleanup(String broker) {
}

// clean system bundles in the end
for (var etr : orphanSystemBundles.entrySet()) {
overrideOwnership(etr.getKey(), etr.getValue(), broker);
for (var orphanSystemServiceUnit : orphanSystemServiceUnits.entrySet()) {
log.info("Overriding orphan system service unit:{}", orphanSystemServiceUnit.getKey());
overrideOwnership(orphanSystemServiceUnit.getKey(), orphanSystemServiceUnit.getValue(), broker);
}

try {
Expand Down

0 comments on commit 55aabce

Please sign in to comment.