You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "MarcosZyk (via GitHub)" <gi...@apache.org> on 2023/11/15 08:00:34 UTC

[PR] Refactor CachedMTreeStore.updateMNode interface usage and implementation in PBTree [iotdb]

MarcosZyk opened a new pull request, #11546:
URL: https://github.com/apache/iotdb/pull/11546

   ## Description
   
   
   ### Motivation
   In the original implementation, the attribute modification is not protected by the read lock, therefore a node already in buffer may experience redundant flush while the updated info may already be synced to disk.
   
   Here's a simple example. 
   
   MNode A is already in buffer since it may be newly added to MTree or recently updated. 
   
   Thread A tries to modify some attribute in it while the flush thread starts a flush process and take the write lock in advance. 
   
   In this case, the modified info will be synced to disk by this flush process, but thread A may still invoke the updateMNode method to add the node to buffer after this flush. 
   
   The result is a node with nothing new will experience another flush process.
   
   ### Modification
   
   Refactor the updateMNode method to require the invokers to pass the specific update process as a consumer, which will be protected by read lock.
   
   
   
   


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


Re: [PR] Refactor CachedMTreeStore.updateMNode interface usage and implementation in PBTree [iotdb]

Posted by "MarcosZyk (via GitHub)" <gi...@apache.org>.
MarcosZyk merged PR #11546:
URL: https://github.com/apache/iotdb/pull/11546


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


Re: [PR] Refactor CachedMTreeStore.updateMNode interface usage and implementation in PBTree [iotdb]

Posted by "MarcosZyk (via GitHub)" <gi...@apache.org>.
MarcosZyk commented on code in PR #11546:
URL: https://github.com/apache/iotdb/pull/11546#discussion_r1393840409


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/IMTreeStore.java:
##########
@@ -73,7 +74,7 @@ IMNodeIterator<N> getTraverserIterator(
 
   void deleteChild(N parent, String childName) throws MetadataException;
 
-  void updateMNode(N node) throws MetadataException;
+  void updateMNode(N node, Consumer<N> consumer) throws MetadataException;

Review Comment:
   Java doc added.



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


Re: [PR] Refactor CachedMTreeStore.updateMNode interface usage and implementation in PBTree [iotdb]

Posted by "Cpaulyz (via GitHub)" <gi...@apache.org>.
Cpaulyz commented on code in PR #11546:
URL: https://github.com/apache/iotdb/pull/11546#discussion_r1393823350


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/IMTreeStore.java:
##########
@@ -73,7 +74,7 @@ IMNodeIterator<N> getTraverserIterator(
 
   void deleteChild(N parent, String childName) throws MetadataException;
 
-  void updateMNode(N node) throws MetadataException;
+  void updateMNode(N node, Consumer<N> consumer) throws MetadataException;

Review Comment:
   ```suggestion
     /**
      * Update the mnode under the guarantee of latch.
      *
      * @param node node to be updated
      * @updation update operation
      */
     void updateMNode(N node, Consumer<N> updation) throws MetadataException;
   ```



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