xy2953396112 commented on code in PR #3548:
URL: https://github.com/apache/celeborn/pull/3548#discussion_r2693193050
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/FlushTask.scala:
##########
@@ -98,18 +98,28 @@ abstract private[worker] class DfsFlushTask(
private[worker] class HdfsFlushTask(
buffer: CompositeByteBuf,
+ hdfsStream: FSDataOutputStream,
val path: Path,
notifier: FlushNotifier,
keepBuffer: Boolean,
source: AbstractSource) extends DfsFlushTask(buffer, notifier, keepBuffer,
source) {
override def flush(copyBytes: Array[Byte]): Unit = {
val readableBytes = buffer.readableBytes()
- val hadoopFs = StorageManager.hadoopFs.get(Type.HDFS)
- val hdfsStream = hadoopFs.append(path, 256 * 1024)
- flush(hdfsStream) {
- hdfsStream.write(convertBufferToBytes(buffer, copyBytes, readableBytes))
- source.incCounter(WorkerSource.HDFS_FLUSH_COUNT)
- source.incCounter(WorkerSource.HDFS_FLUSH_SIZE, readableBytes)
+ if (hdfsStream != null) {
+ // TODO : If the FSDataOutputStream supports concurrent writes, the lock
can be removed.
+ hdfsStream.synchronized {
+ hdfsStream.write(convertBufferToBytes(buffer, copyBytes,
readableBytes))
Review Comment:
OK, I have updated the code, PTAL~
--
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]