You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/10/31 06:30:26 UTC

[GitHub] [iotdb] JackieTien97 commented on a change in pull request #4279: [IOTDB-1609] Print the actual size of plan when it exceeds the wal_buffer_size

JackieTien97 commented on a change in pull request #4279:
URL: https://github.com/apache/iotdb/pull/4279#discussion_r739764008



##########
File path: server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
##########
@@ -115,8 +113,15 @@ public void write(PhysicalPlan plan) throws IOException {
     } catch (BufferOverflowException e) {
       // if the size of a single plan bigger than logBufferWorking
       // we need to clear the buffer to drop something wrong that has written.
+      DataOutputStream dos = new DataOutputStream(new ByteArrayOutputStream());
+      plan.serialize(dos);
+      int neededSize = dos.size();
+      dos.close();

Review comment:
       It seems that there is no need to really do the serialization to get the actual size, maybe you can add a new method like `getSerializedSize()` in `PhysicalPlan`, each actual plan class to override that method to calculate its own size. In this way, you can avoid allocate extra memory in this `BufferOverflowException` situation.




-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org