sarvekshayr opened a new pull request, #11570:
URL: https://github.com/apache/ozone/pull/11570
## What changes were proposed in this pull request?
`ozone debug replicas chunk-info` writes JSON to stdout through a Jackson
JsonGenerator and prints per-datanode errors (`Error getting block from
datanode ...`) to stderr. Client logs, such as `INFO scm.XceiverClientGrpc:
XceiverClientGrpc is created for pipeline ...`, also go to stderr. The
generator does not end a datanode's JSON object with a newline, so when stdout
and stderr are merged, a message can be written on the same line as the closing
`}`:
```
} ]
}
}26/10/16 11:24:19 INFO scm.XceiverClientGrpc: XceiverClientGrpc is
created for pipeline ...
], [ {
```
Tools that strip log lines by line then remove the `}` closing brace
together with the log message, and the remaining output is no longer valid
JSON.
Fix: In `ChunkKeyHandler`, call `System.out.println()` after flushing each
datanode's JSON object, so stderr messages never share a line with JSON.
## What is the link to the Apache JIRA
[HDDS-17076](https://issues.apache.org/jira/browse/HDDS-17076)
## How was this patch tested?
Manually tested on docker.
- Without the fix: Log/error on the same line as closing brace.
```
"checksumType" : "CRC32",
"bytesPerChecksum" : 16384
} ]
}
}Error getting block from datanode ozone-ha-datanode-1.ozone-ha_default:
Cannot invoke
"org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos$ReadContainerResponseProto.getContainerData()"
because the return value of "java.util.Map.get(Object)" is null
, {
"datanode" : {
"hostname" : "ozone-ha-datanode-2.ozone-ha_default",
"ip" : "172.19.0.13",
"uuid" : "14a91b12-22ee-4397-8fc9-c4822789119f"
},
"file" :
"/data/hdds/hdds/CID-d9f8df59-b301-4d57-aea3-2a9da65c5a6b/current/containerDir0/2/chunks/117889302528001002.block",
"blockData" : {
"blockID" : {
"containerID" : 2,
"localID" : 117889302528001002,
"blockCommitSequenceId" : 3398
},
```
- With the fix: Log/error prints after the new line.
```
"checksumType" : "CRC32",
"bytesPerChecksum" : 16384
} ]
}
}
Error getting block from datanode ozone-ha-datanode-1.ozone-ha_default:
Cannot invoke
"org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos$ReadContainerResponseProto.getContainerData()"
because the return value of "java.util.Map.get(Object)" is null
, {
"datanode" : {
"hostname" : "ozone-ha-datanode-3.ozone-ha_default",
"ip" : "172.19.0.2",
"uuid" : "aec991f9-937d-420a-98a9-e5d3dbcf7a56"
},
"file" :
"/data/hdds/hdds/CID-2b68e0dc-44fd-4ec6-922e-9634422ac9b0/current/containerDir0/1/chunks/117889302528000001.block",
"blockData" : {
"blockID" : {
"containerID" : 1,
"localID" : 117889302528000001,
"blockCommitSequenceId" : 2
},
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]