ChaomingZhangCN commented on code in PR #453:
URL: https://github.com/apache/paimon-cpp/pull/453#discussion_r4357460610


##########
test/inte/data_evolution_table_test.cpp:
##########
@@ -57,6 +61,36 @@
 #include "paimon/testing/utils/test_helper.h"
 #include "paimon/testing/utils/testharness.h"
 namespace paimon::test {
+namespace {
+class CountingLocalFileSystem : public LocalFileSystem {
+ public:
+    explicit CountingLocalFileSystem(const std::string& failed_path = "")
+        : failed_path_(failed_path) {}
+
+    Result<std::unique_ptr<InputStream>> Open(const std::string& path) const 
override {
+        {
+            std::scoped_lock lock(mutex_);
+            ++open_counts_[path];
+        }
+        if (path == failed_path_) {
+            return Status::IOError("injected open failure: " + path);
+        }
+        return LocalFileSystem::Open(path);
+    }
+
+    int64_t OpenCount(const std::string& path) const {
+        std::scoped_lock lock(mutex_);
+        auto iter = open_counts_.find(path);
+        return iter == open_counts_.end() ? 0 : iter->second;
+    }
+
+ private:
+    mutable std::mutex mutex_;
+    mutable std::map<std::string, int64_t> open_counts_;
+    std::string failed_path_;
+};
+}  // namespace
+

Review Comment:
   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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to