nsivabalan commented on code in PR #10067:
URL: https://github.com/apache/hudi/pull/10067#discussion_r1397971781
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/streamer/StreamSync.java:
##########
@@ -999,14 +1007,19 @@ public void runMetaSync() {
Map<String, HoodieException> failedMetaSyncs = new HashMap<>();
for (String impl : syncClientToolClasses) {
Timer.Context syncContext = metrics.getMetaSyncTimerContext();
+ boolean success = false;
try {
SyncUtilHelpers.runHoodieMetaSync(impl.trim(), metaProps, conf, fs,
cfg.targetBasePath, cfg.baseFileFormat);
+ success = true;
} catch (HoodieMetaSyncException e) {
- LOG.warn("SyncTool class " + impl.trim() + " failed with exception",
e);
+ LOG.error("SyncTool class " + impl.trim() + " failed with
exception", e);
failedMetaSyncs.put(impl, e);
}
long metaSyncTimeMs = syncContext != null ? syncContext.stop() : 0;
metrics.updateStreamerMetaSyncMetrics(getSyncClassShortName(impl),
metaSyncTimeMs);
+ if (success) {
+ LOG.info("[MetaSync] SyncTool class " + impl.trim() + " completed
successfully and took " + metaSyncTimeMs);
Review Comment:
have not used this style before. got to read about the diff b/w
String.format and this style.
```
Usually, in the code there are lots of low level logs (debug, info) you
don't want to see in production. If you use for example String.format to format
the string to log, then you will allocate on the heap and format a new String,
which can be very long and consume resources, even if at the end nothing will
be logged (for example if the log4j min level is set to warning or error).
By using the logger formatter system (like the one from log4j), you allow
your logger to avoid the generation of the formatted string if it doesn't need
to be logged.
This may make a great difference in some cases.
```
Ref:
https://stackoverflow.com/questions/30975026/log4j-implicit-string-formatting
thanks for the suggestion. will fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]