github-actions[bot] commented on code in PR #17246:
URL: https://github.com/apache/doris/pull/17246#discussion_r1122877786
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
"{}/{}", kTestDir, path.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@ static StorageEngine* k_engine = nullptr;
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
Review Comment:
warning: no matching constructor for initialization of 'io::FileWriter'
[clang-diagnostic-error]
```cpp
FileWriterMock(Path path) : io::FileWriter(path) {
^
```
**be/src/io/fs/file_writer.h:32:** candidate constructor not viable: expects
an rvalue for 1st argument
```cpp
FileWriter(Path&& path) : _path(std::move(path)) {}
^
```
**be/src/io/fs/file_writer.h:35:** candidate constructor not viable: no
known conversion from 'doris::io::Path' (aka 'std::filesystem::path') to 'const
doris::io::FileWriter' for 1st argument
```cpp
DISALLOW_COPY_AND_ASSIGN(FileWriter);
^
```
**thirdparty/installed/include/butil/macros.h:42:** expanded from macro
'DISALLOW_COPY_AND_ASSIGN'
```cpp
BUTIL_DELETE_FUNCTION(TypeName(const TypeName&)); \
^
```
**thirdparty/installed/include/butil/macros.h:28:** expanded from macro
'BUTIL_DELETE_FUNCTION'
```cpp
#define BUTIL_DELETE_FUNCTION(decl) decl = delete
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
Review Comment:
warning: no matching constructor for initialization of
'io::RemoteFileSystem' [clang-diagnostic-error]
```cpp
: RemoteFileSystem(root_path, id, type) {
^
```
**be/src/io/fs/remote_file_system.h:26:** candidate constructor not viable:
expects an rvalue for 1st argument
```cpp
RemoteFileSystem(Path&& root_path, std::string&& id, FileSystemType type)
^
```
**be/src/io/fs/remote_file_system.h:24:** candidate constructor (the
implicit copy constructor) not viable: requires 1 argument, but 3 were provided
```cpp
class RemoteFileSystem : public FileSystem {
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
Review Comment:
warning: unknown type name 'LocalFileWriter'; did you mean 'FileWriter'?
[clang-diagnostic-error]
```suggestion
*_local_file_writer = std::make_unique<FileWriter>(fmt::format(
```
**be/src/io/fs/file_writer.h:30:** 'FileWriter' declared here
```cpp
class FileWriter {
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
root_path.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->delete_directory(fmt::format("{}/{}",
kTestDir, path.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
+ }
+
+ Status exists(const Path& path, bool* res) const override {
+ return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
+ }
+
+ Status exists(const Path& path, bool* res) const override {
+ return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
+ }
+
+ Status file_size(const Path& path, size_t* file_size) const override {
+ return _local_fs->file_size(fmt::format("{}/{}", kTestDir,
path.str()), file_size);
+ }
+
+ Status list(const Path& path, std::vector<Path>* files) override {
+ std::vector<Path> local_paths;
+ RETURN_IF_ERROR(_local_fs->list(fmt::format("{}/{}", kTestDir,
path.str()),
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
RETURN_IF_ERROR(_local_fs->list(fmt::format("{}/{}", kTestDir,
path.str()),
^
```
**be/src/common/status.h:500:** expanded from macro 'RETURN_IF_ERROR'
```cpp
Status _status_ = (stmt); \
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
+ }
+
+ Status exists(const Path& path, bool* res) const override {
+ return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
+ }
+
+ Status file_size(const Path& path, size_t* file_size) const override {
+ return _local_fs->file_size(fmt::format("{}/{}", kTestDir,
path.str()), file_size);
+ }
+
+ Status list(const Path& path, std::vector<Path>* files) override {
+ std::vector<Path> local_paths;
+ RETURN_IF_ERROR(_local_fs->list(fmt::format("{}/{}", kTestDir,
path.str()),
+ &local_paths));
+ for (Path path : local_paths) {
+ files->emplace_back(path.str().substr(kTestDir.size() + 1));
+ }
+ return Status::OK();
+ }
+
+ Status upload(const Path& local_path, const Path& dest_path) override {
+ return link_file(local_path, dest_path);
+ }
+
+ Status batch_upload(const std::vector<Path>& local_paths,
+ const std::vector<Path>& dest_paths) override {
+ for (int i = 0; i < local_paths.size(); ++i) {
+ RETURN_IF_ERROR(link_file(local_paths[i], dest_paths[i]));
+ }
+ return Status::OK();
+ }
+
+ Status batch_delete(const std::vector<Path>& paths) override {
+ for (int i = 0; i < paths.size(); ++i) {
+ RETURN_IF_ERROR(delete_file(paths[i]));
+ }
+ return Status::OK();
+ }
+
+ Status connect() override {
+ return Status::OK();
+ }
+ private:
+ std::shared_ptr<LocalFileSystem> _local_fs;
Review Comment:
warning: unknown type name 'LocalFileSystem'; did you mean
'io::LocalFileSystem'? [clang-diagnostic-error]
```suggestion
std::shared_ptr<io::LocalFileSystem> _local_fs;
```
**be/src/io/fs/local_file_system.h:24:** 'io::LocalFileSystem' declared here
```cpp
class LocalFileSystem final : public FileSystem {
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
Review Comment:
warning: unknown type name 'LocalFileWriter'; did you mean 'FileWriter'?
[clang-diagnostic-error]
```suggestion
std::unique_ptr<FileWriter> _local_file_writer;
```
**be/src/io/fs/file_writer.h:30:** 'FileWriter' declared here
```cpp
class FileWriter {
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
+ }
+
+ Status exists(const Path& path, bool* res) const override {
+ return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
+ }
+
+ Status file_size(const Path& path, size_t* file_size) const override {
+ return _local_fs->file_size(fmt::format("{}/{}", kTestDir,
path.str()), file_size);
+ }
+
+ Status list(const Path& path, std::vector<Path>* files) override {
+ std::vector<Path> local_paths;
+ RETURN_IF_ERROR(_local_fs->list(fmt::format("{}/{}", kTestDir,
path.str()),
+ &local_paths));
+ for (Path path : local_paths) {
+ files->emplace_back(path.str().substr(kTestDir.size() + 1));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
files->emplace_back(path.str().substr(kTestDir.size() + 1));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->create_directory(fmt::format("{}/{}",
kTestDir, path.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
fmt::format("{}/{}", kTestDir,
dest.str()));
^
```
##########
be/test/olap/tablet_cooldown_test.cpp:
##########
@@ -40,22 +42,139 @@
static const std::string kTestDir = "./ut_dir/tablet_cooldown_test";
static constexpr int64_t kResourceId = 10000;
static constexpr int64_t kStoragePolicyId = 10002;
+static constexpr int64_t kTabletId = 10005;
+static constexpr int64_t kReplicaId = 10009;
+static constexpr int64_t kSchemaHash = 270068377;
+
+using io::Path;
+
+static io::FileSystemSPtr s_fs;
-// remove DISABLED_ when need run this test
-#define TabletCooldownTest DISABLED_TabletCooldownTest
class TabletCooldownTest : public testing::Test {
+ class FileWriterMock : public io::FileWriter {
+ public:
+ FileWriterMock(Path path) : io::FileWriter(path) {
+ *_local_file_writer =
std::make_unique<LocalFileWriter>(fmt::format(
+ "{}/{}", kTestDir, path.str()));
+ }
+
+ ~FileWriterMock() {}
+
+ Status close() override {
+ return _local_file_writer->close();
+ }
+
+ Status abort() override {
+ return _local_file_writer->abort();
+ }
+
+ Status append(const Slice& data) override {
+ return _local_file_writer->append(data);
+ }
+
+ Status appendv(const Slice* data, size_t data_cnt) override {
+ return _local_file_writer->appendv(data, data_cnt);
+ }
+
+ Status write_at(size_t offset, const Slice& data) override {
+ return _local_file_writer->write_at(offset, data);
+ }
+
+ Status finalize() override {
+ return _local_file_writer->finalize();
+ }
+
+ size_t bytes_appended() const override { return
_local_file_writer->bytes_appended(); }
+
+ io::FileSystemSPtr fs() const override { return s_fs; }
+ private:
+ std::unique_ptr<LocalFileWriter> _local_file_writer;
+ };
+
+ class RemoteFileSystemMock : public io::RemoteFileSystem {
+ RemoteFileSystemMock(Path root_path, std::string&& id,
io::FileSystemType type)
+ : RemoteFileSystem(root_path, id, type) {
+ _local_fs = io::LocalFileSystem::create(fmt::format("{}/{}",
kTestDir,
+
root_path.str()));
+ }
+ ~RemoteFileSystemMock() override {}
+
+ Status create_file(const Path& path, io::FileWriterPtr* writer)
override {
+ *writer = std::make_unique<FileWriterMock>(path);
+ return Status::OK();
+ }
+
+ Status open_file(const Path& path, io::FileReaderSPtr* reader,
IOContext* io_ctx) override {
+ return _local_fs->open_file(fmt::format("{}/{}", kTestDir,
path.str()), reader, io_ctx);
+ }
+
+ Status delete_file(const Path& path) override {
+ return _local_fs->delete_file(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status create_directory(const Path& path) override {
+ return _local_fs->create_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status delete_directory(const Path& path) override {
+ return _local_fs->delete_directory(fmt::format("{}/{}", kTestDir,
path.str()));
+ }
+
+ Status link_file(const Path& src, const Path& dest) override {
+ return _local_fs->link_file(fmt::format("{}/{}", kTestDir,
src.str()),
+ fmt::format("{}/{}", kTestDir,
dest.str()));
+ }
+
+ Status exists(const Path& path, bool* res) const override {
+ return _local_fs->exists(fmt::format("{}/{}", kTestDir,
path.str()), res);
+ }
+
+ Status file_size(const Path& path, size_t* file_size) const override {
+ return _local_fs->file_size(fmt::format("{}/{}", kTestDir,
path.str()), file_size);
Review Comment:
warning: no member named 'str' in 'std::filesystem::path'
[clang-diagnostic-error]
```cpp
return _local_fs->file_size(fmt::format("{}/{}", kTestDir,
path.str()), file_size);
^
```
--
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]