Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tea/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
#include "tea/table/filter_convert.h"
#include "tea/table/gp_funcs.h"
#include "tea/table/shared_state.h"
#include "tea/util/defer.h"
#include "tea/util/logger.h"
#include "tea/util/measure.h"
#include "tea/util/multishot_timer.h"
Expand Down Expand Up @@ -109,7 +108,7 @@ class LoggingInputFile : public iceberg::InputFileWrapper {

arrow::Result<int64_t> ReadAt(int64_t position, int64_t nbytes, void* out) override {
metrics_->wait_read_stats->Resume();
Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
iceberg::Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
TakeRequestIntoAccount(nbytes);
auto result = InputFileWrapper::ReadAt(position, nbytes, out);
if (!result.ok()) {
Expand All @@ -120,7 +119,7 @@ class LoggingInputFile : public iceberg::InputFileWrapper {

arrow::Result<int64_t> Read(int64_t nbytes, void* out) override {
metrics_->wait_read_stats->Resume();
Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
iceberg::Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
TakeRequestIntoAccount(nbytes);
auto result = InputFileWrapper::Read(nbytes, out);
if (!result.ok()) {
Expand All @@ -131,7 +130,7 @@ class LoggingInputFile : public iceberg::InputFileWrapper {

arrow::Result<std::shared_ptr<arrow::Buffer>> Read(int64_t nbytes) override {
metrics_->wait_read_stats->Resume();
Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
iceberg::Defer defer([&]() { metrics_->wait_read_stats->Suspend(); });
TakeRequestIntoAccount(nbytes);
auto result = InputFileWrapper::Read(nbytes);
if (!result.ok()) {
Expand Down
11 changes: 2 additions & 9 deletions tea/smoke_test/negative_server_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "arrow/status.h"
#include "gtest/gtest.h"
#include "iceberg/common/defer.h"

#include "tea/smoke_test/environment.h"
#include "tea/smoke_test/pq.h"
Expand All @@ -20,15 +21,7 @@ namespace {
class NegativeServer : public TeaTest {};
} // namespace

class Defer {
public:
explicit Defer(const std::function<void()>& func) : func_(func) {}

~Defer() { func_(); }

private:
std::function<void()> func_;
};
using Defer = iceberg::Defer;

TEST_F(NegativeServer, NoRedis) {
if (Environment::GetProfile() != "samovar") {
Expand Down
11 changes: 2 additions & 9 deletions tea/smoke_test/samovar_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "arrow/status.h"
#include "gtest/gtest.h"
#include "iceberg/common/defer.h"

#include "tea/common/config.h"
#include "tea/samovar/network_layer/backoff.h"
Expand Down Expand Up @@ -41,15 +42,7 @@ namespace {
class SamovarTest : public TeaTest {};
} // namespace

class Defer {
public:
explicit Defer(const std::function<void()>& func) : func_(func) {}

~Defer() { func_(); }

private:
std::function<void()> func_;
};
using Defer = iceberg::Defer;

TEST_F(SamovarTest, NoRedis) {
if (Environment::GetProfile() != "samovar") {
Expand Down
23 changes: 0 additions & 23 deletions tea/util/defer.h

This file was deleted.

Loading