You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/11/25 03:42:41 UTC

[GitHub] [incubator-doris] killxdcj opened a new pull request #7216: [Feature]. Improve DeltaWriter's performance.

killxdcj opened a new pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216


   ## Proposed changes
   
   Improve DeltaWriter's performance, detail in #7214
   
   - Support batch write for DeltaWriter.
   
   - Use mutex instead of SpinLock.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   - [ ] Code refactor (Modify the code structure, format the code, etc...)
   - [x] Optimization. Including functional usability improvements and performance improvements.
   - [ ] Dependency. Such as changes related to third-party components.
   - [ ] Other.
   
   ## Checklist
   
   - [x] I have created an issue on (Fix #7214) and described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [ ] Any dependent changes have been merged
   


-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] killxdcj commented on pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
killxdcj commented on pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#issuecomment-979203857


   > 
   
   @morningman BE ut fixed~


-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#issuecomment-979284261


   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] killxdcj commented on a change in pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
killxdcj commented on a change in pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#discussion_r756593707



##########
File path: be/src/olap/delta_writer.cpp
##########
@@ -179,6 +180,26 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
     return OLAP_SUCCESS;
 }
 
+OLAPStatus DeltaWriter::write(const RowBatch* row_batch, const std::vector<int>& row_idxs) {
+    std::lock_guard<std::mutex> l(_lock);
+    if (!_is_init && !_is_cancelled) {
+        RETURN_NOT_OK(init());
+    }
+
+    if (_is_cancelled) {
+        return OLAP_ERR_ALREADY_CANCELLED;
+    }
+
+    for (const auto& row_idx : row_idxs) {
+        _mem_table->insert(row_batch->get_row(row_idx)->get_tuple(0));
+        if (_mem_table->memory_usage() >= config::write_buffer_size) {

Review comment:
       Comment resolved~




-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman merged pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216


   


-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#discussion_r756552049



##########
File path: be/src/olap/delta_writer.cpp
##########
@@ -179,6 +180,26 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
     return OLAP_SUCCESS;
 }
 
+OLAPStatus DeltaWriter::write(const RowBatch* row_batch, const std::vector<int>& row_idxs) {
+    std::lock_guard<std::mutex> l(_lock);
+    if (!_is_init && !_is_cancelled) {
+        RETURN_NOT_OK(init());
+    }
+
+    if (_is_cancelled) {
+        return OLAP_ERR_ALREADY_CANCELLED;
+    }
+
+    for (const auto& row_idx : row_idxs) {
+        _mem_table->insert(row_batch->get_row(row_idx)->get_tuple(0));
+        if (_mem_table->memory_usage() >= config::write_buffer_size) {

Review comment:
       I think we can move this memory check outside the for loop.
   Maybe inaccurate, but its ok~




-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#issuecomment-978970911






-- 
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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on pull request #7216: [Feature]. Improve DeltaWriter's performance.

Posted by GitBox <gi...@apache.org>.
morningman commented on pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#issuecomment-978971235


   Hi @killxdcj , please fix BE 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: commits-unsubscribe@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org