You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "BePPPower (via GitHub)" <gi...@apache.org> on 2023/02/28 15:06:10 UTC

[GitHub] [doris] BePPPower opened a new pull request, #17261: [Enhencement](File Reader) delete old file_reader

BePPPower opened a new pull request, #17261:
URL: https://github.com/apache/doris/pull/17261

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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] [doris] yiguolei commented on a diff in pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #17261:
URL: https://github.com/apache/doris/pull/17261#discussion_r1120980651


##########
be/src/exec/arrow/arrow_reader.cpp:
##########
@@ -199,48 +199,42 @@ ArrowFile::~ArrowFile() {
 }
 
 arrow::Status ArrowFile::Close() {
-    if (_file != nullptr) {
-        _file->close();
-        delete _file;
-        _file = nullptr;
-    }
     return arrow::Status::OK();
 }
 
 bool ArrowFile::closed() const {
-    if (_file != nullptr) {
-        return _file->closed();
-    } else {
-        return true;
-    }
+    return _file_reader->closed();
 }
 
 arrow::Result<int64_t> ArrowFile::Read(int64_t nbytes, void* buffer) {
     return ReadAt(_pos, nbytes, buffer);
 }
 
 arrow::Result<int64_t> ArrowFile::ReadAt(int64_t position, int64_t nbytes, void* out) {
-    int64_t reads = 0;
     int64_t bytes_read = 0;
     _pos = position;
-    while (nbytes > 0) {
-        Status result = _file->readat(_pos, nbytes, &reads, out);
+    int64_t total_reads = 0;

Review Comment:
   Any difference between bytes_read and total_reads?



-- 
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] [doris] yiguolei commented on a diff in pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #17261:
URL: https://github.com/apache/doris/pull/17261#discussion_r1120981441


##########
be/src/util/broker_storage_backend.cpp:
##########
@@ -72,14 +89,14 @@ Status BrokerStorageBackend::download(const std::string& remote, const std::stri
     constexpr size_t buf_sz = 1024 * 1024;
     char read_buf[buf_sz];
     size_t write_offset = 0;
-    bool eof = false;
-    while (!eof) {
-        int64_t read_len = 0;
-        RETURN_IF_ERROR(
-                broker_reader->read(reinterpret_cast<uint8_t*>(read_buf), buf_sz, &read_len, &eof));
-
-        if (eof) {
-            continue;
+    size_t cur_offset = 0;
+    while (true) {
+        size_t read_len = 0;
+        Slice file_slice(reinterpret_cast<uint8_t*>(read_buf), buf_sz);
+        RETURN_IF_ERROR(broker_reader->read_at(cur_offset, file_slice, io_ctx, &read_len));
+        cur_offset += read_len;
+        if (read_len == 0) {
+            break;
         }
 
         if (read_len > 0) {

Review Comment:
   This if is meaningless.



-- 
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] [doris] github-actions[bot] commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1448360672

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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] [doris] github-actions[bot] commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1449442950

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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] [doris] github-actions[bot] commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1449685470

   PR approved by anyone 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] [doris] yiguolei merged pull request #17261: [Enhencement](File Reader) delete old file_reader

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


-- 
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] [doris] github-actions[bot] commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1449685364

   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] [doris] yiguolei commented on a diff in pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #17261:
URL: https://github.com/apache/doris/pull/17261#discussion_r1120982596


##########
be/src/util/hdfs_storage_backend.cpp:
##########
@@ -183,13 +196,14 @@ Status HDFSStorageBackend::download(const std::string& remote, const std::string
     constexpr size_t buf_sz = 1024 * 1024;
     char read_buf[buf_sz];

Review Comment:
   same problem here for read_buf.



-- 
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] [doris] yiguolei commented on a diff in pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #17261:
URL: https://github.com/apache/doris/pull/17261#discussion_r1120982764


##########
be/src/util/hdfs_storage_backend.cpp:
##########
@@ -206,19 +220,30 @@ Status HDFSStorageBackend::download(const std::string& remote, const std::string
 }
 
 Status HDFSStorageBackend::direct_download(const std::string& remote, std::string* content) {
-    std::unique_ptr<HdfsFileReader> hdfs_reader(new HdfsFileReader(_properties, remote, 0));
-    RETURN_IF_ERROR(hdfs_reader->open());
+    std::shared_ptr<io::FileSystem> file_system;
+    io::FileReaderSPtr hdfs_reader = nullptr;
+    auto cache_policy = io::FileCachePolicy::NO_CACHE;
+    IOContext io_ctx;
+    if (config::enable_file_cache && io_ctx.enable_file_cache) {
+        cache_policy = io::FileCachePolicy::FILE_BLOCK_CACHE;
+    }
+    io::FileBlockCachePathPolicy file_block_cache;
+    io::FileReaderOptions reader_options(cache_policy, file_block_cache);
+    THdfsParams hdfs_params = parse_properties(_properties);
+    RETURN_IF_ERROR(FileFactory::create_hdfs_reader(hdfs_params, remote, &file_system, &hdfs_reader,
+                                                    reader_options, &io_ctx));
+
     constexpr size_t buf_sz = 1024 * 1024;
     char read_buf[buf_sz];

Review Comment:
   same problem here.



-- 
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] [doris] yiguolei commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1449684341

   run buildall


-- 
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] [doris] hello-stephen commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1448462454

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 34.29 seconds
    stream load tsv:          474 seconds loaded 74807831229 Bytes, about 150 MB/s
    stream load json:         40 seconds loaded 2358488459 Bytes, about 56 MB/s
    stream load orc:          67 seconds loaded 1101869774 Bytes, about 15 MB/s
    stream load parquet:          29 seconds loaded 861443392 Bytes, about 28 MB/s
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230228161539_clickbench_pr_105920.html


-- 
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] [doris] yiguolei commented on a diff in pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on code in PR #17261:
URL: https://github.com/apache/doris/pull/17261#discussion_r1120981986


##########
be/src/util/broker_storage_backend.cpp:
##########
@@ -72,14 +89,14 @@ Status BrokerStorageBackend::download(const std::string& remote, const std::stri
     constexpr size_t buf_sz = 1024 * 1024;
     char read_buf[buf_sz];

Review Comment:
   Do not use array to store buffer. Use a vector please. Array will allocate the buffer on stack and stack is very small.



-- 
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] [doris] BePPPower commented on pull request #17261: [Enhencement](File Reader) delete old file_reader

Posted by "BePPPower (via GitHub)" <gi...@apache.org>.
BePPPower commented on PR #17261:
URL: https://github.com/apache/doris/pull/17261#issuecomment-1448423141

   run buildall


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