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
3 changes: 2 additions & 1 deletion src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ static struct InitFiu
REGULAR(sleep_in_logs_flush) \
ONCE(smt_commit_exception_before_op) \
ONCE(backup_add_empty_memory_table) \
REGULAR(refresh_task_stop_racing_for_running_refresh)
REGULAR(refresh_task_stop_racing_for_running_refresh) \
ONCE(database_iceberg_gcs)


namespace FailPoints
Expand Down
17 changes: 15 additions & 2 deletions src/Databases/DataLake/ICatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@

#include <filesystem>

#include <Common/FailPoint.h>

namespace DB::ErrorCodes
{
extern const int NOT_IMPLEMENTED;
extern const int LOGICAL_ERROR;
extern const int BAD_ARGUMENTS;
}

namespace DB::FailPoints
{
extern const char database_iceberg_gcs[];
}

namespace DataLake
Expand Down Expand Up @@ -49,9 +57,14 @@ StorageType parseStorageTypeFromString(const std::string & type)
}
if (capitalize_first_letter(storage_type_str) == "File")
storage_type_str = "Local";

if (capitalize_first_letter(storage_type_str) == "S3a")
else if (capitalize_first_letter(storage_type_str) == "S3a" || storage_type_str == "oss" || storage_type_str == "gs")
{
fiu_do_on(DB::FailPoints::database_iceberg_gcs,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular bit I don't really like. It's there only for the sake of the integration test. But I've left it intact to be more aligned with the upstream.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better & easier to keep it consistent 👍

{
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Google cloud storage converts to S3");
});
storage_type_str = "S3";
}

auto storage_type = magic_enum::enum_cast<StorageType>(capitalize_first_letter(storage_type_str));

Expand Down
23 changes: 23 additions & 0 deletions tests/integration/test_database_iceberg/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,3 +798,26 @@ def test_cluster_joins(started_cluster):
)

assert res == "Jack\tBlack\nJack\tSilver\nJohn\tBlack\nJohn\tSilver\n"

def test_gcs(started_cluster):
node = started_cluster.instances["node1"]

node.query("SYSTEM ENABLE FAILPOINT database_iceberg_gcs")
node.query(
f"""
DROP DATABASE IF EXISTS {CATALOG_NAME};
SET allow_database_iceberg = 1;
"""
)

with pytest.raises(Exception) as err:
node.query(
f"""
CREATE DATABASE {CATALOG_NAME}
ENGINE = DataLakeCatalog('http://rest:8181/v1', 'gcs', 'dummy')
SETTINGS
catalog_type = 'rest',
warehouse = 'demo',
"""
)
assert "Google cloud storage converts to S3" in str(err.value)
Loading