pengxiangyu commented on a change in pull request #7098:
URL: https://github.com/apache/incubator-doris/pull/7098#discussion_r763590172
##########
File path: be/src/env/env_posix.cpp
##########
@@ -266,13 +277,38 @@ class PosixRandomAccessFile : public RandomAccessFile {
}
}
- Status read_at(uint64_t offset, const Slice& result) const override {
- return do_readv_at(_fd, _filename, offset, &result, 1);
+ Status read_at(uint64_t offset, const Slice* result) const override {
+ return readv_at(offset, result, 1);
+ }
+
+ Status readv_at(uint64_t offset, const Slice* result, size_t res_cnt)
const override {
+ return do_readv_at(_fd, _filename, offset, result, res_cnt);
}
- Status readv_at(uint64_t offset, const Slice* res, size_t res_cnt) const
override {
- return do_readv_at(_fd, _filename, offset, res, res_cnt);
+ Status read_all(std::string* content) const override {
+ std::fstream fs(_filename.c_str(), std::fstream::in);
+ if (!fs.is_open()) {
+ RETURN_NOT_OK_STATUS_WITH_WARN(
+ Status::IOError(
+ strings::Substitute("failed to open cluster id
file $0", _filename)),
+ "open file failed");
+ }
+ std::string data;
+ fs >> data;
+ fs.close();
+ if ((fs.rdstate() & std::fstream::eofbit) != 0) {
+ *content = data;
Review comment:
*content = data; will take the string, these codes are not changed,
they are only moved.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]