TanYuxin-tyx commented on code in PR #22652:
URL: https://github.com/apache/flink/pull/22652#discussion_r1211228446


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/TieredStorageProducerClient.java:
##########
@@ -119,7 +145,66 @@ private void writeAccumulatedBuffers(
     private void writeAccumulatedBuffer(
             TieredStorageSubpartitionId subpartitionId, Buffer 
accumulatedBuffer)
             throws IOException {
-        // TODO, Try to write the accumulated buffer to the appropriate tier. 
After the tier is
-        // decided, then write the accumulated buffer to the tier.
+        int subpartitionIndex = subpartitionId.getSubpartitionId();
+        int tierIndex = chooseStorageTierIfNeeded(subpartitionId);
+
+        Buffer compressedBuffer = compressBufferIfPossible(accumulatedBuffer);
+        updateStatistics(compressedBuffer);
+        boolean isLastBufferInSegment =
+                tierProducerAgents.get(tierIndex).write(subpartitionId, 
compressedBuffer);

Review Comment:
   OK, I have changed the logic of choosing a new tier. 
   
   The return value of `write` show whether the record can be written to the 
tier. If true, continue writing. If not, it will choose a new storage tier.



-- 
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]

Reply via email to