You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "waitinfuture (via GitHub)" <gi...@apache.org> on 2023/04/07 09:54:10 UTC
[GitHub] [incubator-celeborn] waitinfuture opened a new pull request, #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileCh…
waitinfuture opened a new pull request, #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414
…annel.position
<!--
Thanks for sending a pull request! Here are some tips for you:
- Make sure the PR title start w/ a JIRA ticket, e.g. '[CELEBORN-XXXX] Your PR title ...'.
- Be sure to keep the PR description updated to reflect all changes.
- Please write your PR title to summarize what this PR proposes.
- If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
Refine DataPartitionReader to avoid call FileChannel.position
### Why are the changes needed?
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
UT.
--
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
[GitHub] [incubator-celeborn] github-actions[bot] closed pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileChannel.position
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileChannel.position
URL: https://github.com/apache/incubator-celeborn/pull/1414
--
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
[GitHub] [incubator-celeborn] codecov[bot] commented on pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileCh…
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#issuecomment-1500142719
## [Codecov](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1414](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b4fffb0) into [main](https://codecov.io/gh/apache/incubator-celeborn/commit/9b2b8a01ec3e6c348a82b4121e4ae58076fbd8ce?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9b2b8a0) will **decrease** coverage by `0.09%`.
> The diff coverage is `50.00%`.
> :exclamation: Current head b4fffb0 differs from pull request most recent head 21377ce. Consider uploading reports for the commit 21377ce to get more accurate results
```diff
@@ Coverage Diff @@
## main #1414 +/- ##
==========================================
- Coverage 45.01% 44.91% -0.09%
==========================================
Files 164 165 +1
Lines 10405 10408 +3
Branches 1057 1055 -2
==========================================
- Hits 4683 4674 -9
- Misses 5385 5393 +8
- Partials 337 341 +4
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../scala/org/apache/celeborn/common/util/Utils.scala](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvY2VsZWJvcm4vY29tbW9uL3V0aWwvVXRpbHMuc2NhbGE=) | `19.59% <ø> (+0.21%)` | :arrow_up: |
| [...ommon/network/server/MapPartitionStreamReader.java](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9jZWxlYm9ybi9jb21tb24vbmV0d29yay9zZXJ2ZXIvTWFwUGFydGl0aW9uU3RyZWFtUmVhZGVyLmphdmE=) | `24.23% <16.00%> (ø)` | |
| [...orn/common/network/server/BufferStreamManager.java](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9jZWxlYm9ybi9jb21tb24vbmV0d29yay9zZXJ2ZXIvQnVmZmVyU3RyZWFtTWFuYWdlci5qYXZh) | `76.64% <88.24%> (-0.82%)` | :arrow_down: |
| [...common/network/server/FileChannelWithPosition.java](https://codecov.io/gh/apache/incubator-celeborn/pull/1414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9jZWxlYm9ybi9jb21tb24vbmV0d29yay9zZXJ2ZXIvRmlsZUNoYW5uZWxXaXRoUG9zaXRpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
... and [2 files with indirect coverage changes](https://codecov.io/gh/apache/incubator-celeborn/pull/1414/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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
[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileCh…
Posted by "waitinfuture (via GitHub)" <gi...@apache.org>.
waitinfuture commented on code in PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#discussion_r1160662620
##########
common/src/main/java/org/apache/celeborn/common/network/server/DataPartitionReader.java:
##########
@@ -285,47 +284,56 @@ private int readBuffer(
private void updateConsumingOffset() throws IOException {
while (currentPartitionRemainingBytes == 0
- && (currentDataRegion < numRegions - 1 || numRemainingPartitions > 0)) {
- if (numRemainingPartitions <= 0) {
+ && (currentDataRegion < numRegions - 1 || numRemainingPartitionsInCurrentRegion > 0)) {
+ if (numRemainingPartitionsInCurrentRegion <= 0) {
++currentDataRegion;
- numRemainingPartitions = endPartitionIndex - startPartitionIndex + 1;
+ numRemainingPartitionsInCurrentRegion = endPartitionIndex - startPartitionIndex + 1;
// read the target index entry to the target index buffer
indexFileChannel.position(
currentDataRegion * getIndexRegionSize()
+ (long) startPartitionIndex * INDEX_ENTRY_SIZE);
- readHeaderOrIndexBuffer(indexFileChannel, indexBuffer, indexBuffer.capacity());
+ readFully(indexFileChannel, indexBuffer, indexBuffer.capacity());
}
// get the data file offset and the data size
dataConsumingOffset = indexBuffer.getLong();
currentPartitionRemainingBytes = indexBuffer.getLong();
- --numRemainingPartitions;
+ --numRemainingPartitionsInCurrentRegion;
logger.debug(
"readBuffer updateConsumingOffset, {}, {}, {}, {}",
streamId,
- dataFileChannel.size(),
+ dataFileChannelWithPosition.channel.size(),
dataConsumingOffset,
currentPartitionRemainingBytes);
// if these checks fail, the partition file must be corrupted
if (dataConsumingOffset < 0
- || dataConsumingOffset + currentPartitionRemainingBytes > dataFileChannel.size()
+ || dataConsumingOffset + currentPartitionRemainingBytes
+ > dataFileChannelWithPosition.channel.size()
|| currentPartitionRemainingBytes < 0) {
throw new RuntimeException("File " + fileInfo.getFilePath() + " is corrupted");
}
}
}
+ /**
+ * @param buffer
+ * @return true if current region has more data after reading
+ * @throws IOException
+ */
private boolean readBuffer(ByteBuf buffer) throws IOException {
try {
- dataFileChannel.position(dataConsumingOffset);
+ if (dataFileChannelWithPosition.position != dataConsumingOffset) {
Review Comment:
done
--
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
[GitHub] [incubator-celeborn] RexXiong commented on a diff in pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileCh…
Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong commented on code in PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#discussion_r1160603934
##########
common/src/main/java/org/apache/celeborn/common/network/server/DataPartitionReader.java:
##########
@@ -285,47 +284,56 @@ private int readBuffer(
private void updateConsumingOffset() throws IOException {
while (currentPartitionRemainingBytes == 0
- && (currentDataRegion < numRegions - 1 || numRemainingPartitions > 0)) {
- if (numRemainingPartitions <= 0) {
+ && (currentDataRegion < numRegions - 1 || numRemainingPartitionsInCurrentRegion > 0)) {
+ if (numRemainingPartitionsInCurrentRegion <= 0) {
++currentDataRegion;
- numRemainingPartitions = endPartitionIndex - startPartitionIndex + 1;
+ numRemainingPartitionsInCurrentRegion = endPartitionIndex - startPartitionIndex + 1;
// read the target index entry to the target index buffer
indexFileChannel.position(
currentDataRegion * getIndexRegionSize()
+ (long) startPartitionIndex * INDEX_ENTRY_SIZE);
- readHeaderOrIndexBuffer(indexFileChannel, indexBuffer, indexBuffer.capacity());
+ readFully(indexFileChannel, indexBuffer, indexBuffer.capacity());
}
// get the data file offset and the data size
dataConsumingOffset = indexBuffer.getLong();
currentPartitionRemainingBytes = indexBuffer.getLong();
- --numRemainingPartitions;
+ --numRemainingPartitionsInCurrentRegion;
logger.debug(
"readBuffer updateConsumingOffset, {}, {}, {}, {}",
streamId,
- dataFileChannel.size(),
+ dataFileChannelWithPosition.channel.size(),
dataConsumingOffset,
currentPartitionRemainingBytes);
// if these checks fail, the partition file must be corrupted
if (dataConsumingOffset < 0
- || dataConsumingOffset + currentPartitionRemainingBytes > dataFileChannel.size()
+ || dataConsumingOffset + currentPartitionRemainingBytes
+ > dataFileChannelWithPosition.channel.size()
|| currentPartitionRemainingBytes < 0) {
throw new RuntimeException("File " + fileInfo.getFilePath() + " is corrupted");
}
}
}
+ /**
+ * @param buffer
+ * @return true if current region has more data after reading
+ * @throws IOException
+ */
private boolean readBuffer(ByteBuf buffer) throws IOException {
try {
- dataFileChannel.position(dataConsumingOffset);
+ if (dataFileChannelWithPosition.position != dataConsumingOffset) {
Review Comment:
we can make dataFileChannelWithPosition provide a position method to do this.
##########
common/src/main/java/org/apache/celeborn/common/network/server/BufferStreamManager.java:
##########
@@ -428,7 +429,7 @@ public boolean releaseStream(Long streamId) {
public void close() {
logger.info("release map data partition {}", fileInfo);
- IOUtils.closeQuietly(dataFileChanel);
+ IOUtils.closeQuietly(dataFileChanelWithPosition.channel);
Review Comment:
can we let dataFileChanelWithPosition extends Closeable?
##########
common/src/main/java/org/apache/celeborn/common/network/server/FileChannelWithPosition.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.celeborn.common.network.server;
+
+import java.nio.channels.FileChannel;
+
+public class FileChannelWithPosition {
+ public FileChannel channel;
+ public long position;
Review Comment:
IMO, it's not a good idea to expose these fields as public
--
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
[GitHub] [incubator-celeborn] github-actions[bot] commented on pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileChannel.position
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#issuecomment-1556777176
This issue was closed because it has been staled for 10 days with no activity.
--
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
[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileCh…
Posted by "waitinfuture (via GitHub)" <gi...@apache.org>.
waitinfuture commented on code in PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#discussion_r1160662507
##########
common/src/main/java/org/apache/celeborn/common/network/server/BufferStreamManager.java:
##########
@@ -428,7 +429,7 @@ public boolean releaseStream(Long streamId) {
public void close() {
logger.info("release map data partition {}", fileInfo);
- IOUtils.closeQuietly(dataFileChanel);
+ IOUtils.closeQuietly(dataFileChanelWithPosition.channel);
Review Comment:
done
##########
common/src/main/java/org/apache/celeborn/common/network/server/FileChannelWithPosition.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.celeborn.common.network.server;
+
+import java.nio.channels.FileChannel;
+
+public class FileChannelWithPosition {
+ public FileChannel channel;
+ public long position;
Review Comment:
done
--
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
[GitHub] [incubator-celeborn] github-actions[bot] commented on pull request #1414: [CELEBORN-508][FLINK] Refine DataPartitionReader to avoid call FileChannel.position
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1414:
URL: https://github.com/apache/incubator-celeborn/pull/1414#issuecomment-1545377602
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.
--
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