Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to recursively delete table data in Iceberg #6108

Closed
wants to merge 5 commits into from

Conversation

sshkvar
Copy link
Contributor

@sshkvar sshkvar commented Nov 26, 2020

Iceberg removes table metadata only from metastore, but not removes table data and metadata from storage. This PR adding ability to also recursively removes table data and metadata from storage. Added new configuration property which is responsible for enabling/disabling recursive delete of table data on drop.

…able data and metadata from storage. This PR adding ability to also recursively removes table data and metadata from storage. Added new configuration property which is responsible for enabling/disabling recursive delete of table data on drop.
@sshkvar
Copy link
Contributor Author

sshkvar commented Dec 7, 2020

As we discussed in #5616 I have created this PR which is adding ability to recursively delete table data on table drop action

# Conflicts:
#	presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergConfig.java
#	presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java
#	presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadataFactory.java
#	presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergConfig.java
@findepi
Copy link
Member

findepi commented Nov 23, 2021

@sshkvar can you please squash commits and rebase?

@findepi
Copy link
Member

findepi commented Nov 23, 2021

cc @losipiuk @alexjo2144 @phd3

}

public IcebergMetadataFactory(
HiveMetastore metastore,
HdfsEnvironment hdfsEnvironment,
TypeManager typeManager,
JsonCodec<CommitTaskData> commitTaskCodec)
JsonCodec<CommitTaskData> commitTaskCodec,
boolean purgeTableData)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
boolean purgeTableData)
boolean purgeTableDataOnDrop)

Optional<Table> table = metastore.getTable(new HiveIdentity(session), handle.getSchemaName(), handle.getTableName());

metastore.dropTable(new HiveIdentity(session), handle.getSchemaName(), handle.getTableName(), false);
if (purgeDataOnDrop && table.isPresent()) {
Copy link
Member

Choose a reason for hiding this comment

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

What if drop is in the middle of a transaction and if it is aborted ? Deleting these files has to be done only when we commit those changes.

@findepi
Copy link
Member

findepi commented Jun 29, 2022

Iceberg removes table metadata only from metastore, but not removes table data and metadata from storage.

In Iceberg (ie within https://github.com/apache/iceberg) this seems to be dependent on the Catalog implementation.

This PR adding ability to also recursively removes table data and metadata from storage.

I do think Trino does that now, doesn't it?

@mosabua
Copy link
Member

mosabua commented Oct 20, 2022

I think we can close this as this functionality is already implemented from all I know. Can someone like @findepi @findinpath @waraposn or @Praveen2112 confirm.

@findinpath
Copy link
Contributor

Closing the PR because the functionality has been already implemented in #11062

@findinpath findinpath closed this Oct 26, 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.

5 participants