Skip to content

Prevent table creation on non-empty location for Iceberg tables#12626

Merged
findepi merged 2 commits into
trinodb:masterfrom
mdesmet:bug/prevent-table-creation-on-non-empty-path
Jun 8, 2022
Merged

Prevent table creation on non-empty location for Iceberg tables#12626
findepi merged 2 commits into
trinodb:masterfrom
mdesmet:bug/prevent-table-creation-on-non-empty-path

Conversation

@mdesmet
Copy link
Copy Markdown
Contributor

@mdesmet mdesmet commented Jun 1, 2022

Description

Is this change a fix, improvement, new feature, refactoring, or other?

Fix

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

Change to Iceberg connector

How would you describe this change to a non-technical end user or system administrator?

Related issues, pull requests, and links

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
( ) Release notes entries required with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot Bot added the cla-signed label Jun 1, 2022
@findepi findepi requested review from alexjo2144 and ebyhr June 6, 2022 15:43
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the directory exists, but is empty. Should we allow it? That seems reasonable to me

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That can be useful and indeed is safe to do.

(except for concurrency, which we need to ignore anyway)

@mdesmet mdesmet force-pushed the bug/prevent-table-creation-on-non-empty-path branch from ac8aa17 to 4ca1941 Compare June 7, 2022 11:17
@github-actions github-actions Bot added the docs label Jun 7, 2022
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's not only hdfsEnvironment.getFileSystem( what can throw IOE.
change message to

"Failed checking new table's location: " + location

Comment on lines 574 to 575
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use format

Suggested change
throw new TrinoException(ICEBERG_FILESYSTEM_ERROR, "Cannot create a table on a non-empty location: " + location + ", " +
"set 'iceberg.unique-table-location=true' in your Iceberg catalog properties to use unique table locations for every table.");
throw new TrinoException(ICEBERG_FILESYSTEM_ERROR, format(
"Cannot create a table on a non-empty location: %s, set 'iceberg.unique-table-location=true' in your Iceberg catalog properties " +
"to use unique table locations for every table.",
location));

@mdesmet mdesmet force-pushed the bug/prevent-table-creation-on-non-empty-path branch from 971bdd0 to 512e4bf Compare June 8, 2022 10:16
@mdesmet mdesmet force-pushed the bug/prevent-table-creation-on-non-empty-path branch from 512e4bf to cb4b583 Compare June 8, 2022 16:07
@findepi findepi merged this pull request into trinodb:master Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Iceberg CREATE TABLE statement allows to create a table on a location already used by another Iceberg table

4 participants