Michael Blow has submitted this change and it was merged. Change subject: Fix Logging Of Metadata Stores ......................................................................
Fix Logging Of Metadata Stores Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1279 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- M asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java A asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java 2 files changed, 50 insertions(+), 1 deletion(-) Approvals: Till Westmann: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java index e6f3142..ea1f714 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java @@ -39,6 +39,7 @@ import org.apache.asterix.common.replication.IRemoteRecoveryManager; import org.apache.asterix.common.transactions.IRecoveryManager; import org.apache.asterix.common.transactions.IRecoveryManager.SystemState; +import org.apache.asterix.common.utils.PrintUtil; import org.apache.asterix.common.utils.StoragePathUtil; import org.apache.asterix.event.schema.cluster.Cluster; import org.apache.asterix.event.schema.cluster.Node; @@ -209,7 +210,7 @@ if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("System state: " + SystemState.NEW_UNIVERSE); LOGGER.info("Node ID: " + nodeId); - LOGGER.info("Stores: " + metadataProperties.getStores()); + LOGGER.info("Stores: " + PrintUtil.toString(metadataProperties.getStores())); LOGGER.info("Root Metadata Store: " + metadataProperties.getStores().get(nodeId)[0]); } diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java new file mode 100644 index 0000000..8c0e4ff --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.asterix.common.utils; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.Map; + +public class PrintUtil { + private PrintUtil() { + } + + public static String toString(Map<String, ? extends Object[]> map) { + Iterator<? extends Map.Entry<String, ? extends Object[]>> iter = map.entrySet().iterator(); + if (!iter.hasNext()) { + return "{}"; + } + StringBuilder sb = new StringBuilder(); + sb.append('{'); + while (true) { + Map.Entry<String, ? extends Object[]> entry = iter.next(); + sb.append(entry.getKey()); + sb.append('='); + sb.append(Arrays.toString(entry.getValue())); + if (! iter.hasNext()) { + break; + } + sb.append(',').append(' '); + } + return sb.append('}').toString(); + } +} -- To view, visit https://asterix-gerrit.ics.uci.edu/1279 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426 Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]>
