You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "FMX (via GitHub)" <gi...@apache.org> on 2023/02/17 05:02:48 UTC
[GitHub] [incubator-celeborn] FMX commented on a diff in pull request #1225: [CELEBORN-292] optimize mappartitionfilewriter flushing index and reading data header
FMX commented on code in PR #1225:
URL: https://github.com/apache/incubator-celeborn/pull/1225#discussion_r1109306801
##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/storage/MapPartitionFileWriter.java:
##########
@@ -106,36 +103,36 @@ private void takeBufferIndex() {
source.startTimer(metricsName, fileAbsPath);
}
- // real action
- flushBufferIndex = flusher.takeBuffer();
-
// metrics end
if (source.metricsCollectCriticalEnabled()) {
source.stopTimer(metricsName, fileAbsPath);
}
-
- if (flushBufferIndex == null) {
- IOException e =
- new IOException(
- "Take buffer index encounter error from Flusher: " + flusher.bufferQueueInfo());
- notifier.setException(e);
- }
}
public void write(ByteBuf data) throws IOException {
- byte[] header = new byte[16];
data.markReaderIndex();
- data.readBytes(header);
+ int partitionId = data.readInt();
+ int attemptId = data.readInt();
+ int batchId = data.readInt();
+ int size = data.readInt();
+
data.resetReaderIndex();
- int partitionId = Platform.getInt(header, Platform.BYTE_ARRAY_OFFSET);
+ logger.debug(
+ "mappartition filename:{} write partition:{} attemptId:{} batchId:{} size:{}",
+ fileInfo.getFilePath(),
+ partitionId,
+ attemptId,
+ batchId,
+ size);
+
collectPartitionDataLength(partitionId, data);
super.write(data);
}
private void collectPartitionDataLength(int partitionId, ByteBuf data) throws IOException {
Review Comment:
Concurrent issue here cause write will be invoked by multiple threads.
--
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: issues-unsubscribe@celeborn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org