Skip to content

Commit

Permalink
Revert "Add column add/drop/rename events"
Browse files Browse the repository at this point in the history
This reverts commit 33fdaa0.

The current implementation has the following problems:

- does not work for Hive connector with `hive.security=system`
  (#15225 (comment))
- notifications are propagated even if transaction doesn't end up committing
  the DDL changes (#15225 (comment))
- notification propagation may disrupt transaction finish even if changes already
  applied in the external system (#12535 (comment)),
  for any connector that's using SYSTEM security (Iceberg, Delta with system security, or any JDBC connector)
  • Loading branch information
findepi committed Feb 8, 2023
1 parent e27e7af commit 6741a93
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,6 @@ public void tableRenamed(Session session, CatalogSchemaTableName sourceTable, Ca
@Override
public void tableDropped(Session session, CatalogSchemaTableName table) {}

@Override
public void columnCreated(Session session, CatalogSchemaTableName table, String column) {}

@Override
public void columnRenamed(Session session, CatalogSchemaTableName table, String oldColumn, String newColumn) {}

@Override
public void columnDropped(Session session, CatalogSchemaTableName table, String column) {}

private static TrinoException notSupportedException(String catalogName)
{
return new TrinoException(NOT_SUPPORTED, "Catalog does not support permission management: " + catalogName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,14 +726,6 @@ public void renameColumn(Session session, TableHandle tableHandle, ColumnHandle
CatalogHandle catalogHandle = tableHandle.getCatalogHandle();
ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle);
metadata.renameColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), source, target.toLowerCase(ENGLISH));

CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle);
ColumnMetadata sourceColumnMetadata = getColumnMetadata(session, tableHandle, source);
if (catalogMetadata.getSecurityManagement() != CONNECTOR) {
TableMetadata tableMetadata = getTableMetadata(session, tableHandle);
CatalogSchemaTableName sourceTableName = new CatalogSchemaTableName(catalogHandle.getCatalogName(), tableMetadata.getTable());
systemSecurityMetadata.columnRenamed(session, sourceTableName, sourceColumnMetadata.getName(), target);
}
}

@Override
Expand All @@ -742,28 +734,14 @@ public void addColumn(Session session, TableHandle tableHandle, ColumnMetadata c
CatalogHandle catalogHandle = tableHandle.getCatalogHandle();
ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle);
metadata.addColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), column);

CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle);
if (catalogMetadata.getSecurityManagement() != CONNECTOR) {
TableMetadata tableMetadata = getTableMetadata(session, tableHandle);
CatalogSchemaTableName sourceTableName = new CatalogSchemaTableName(catalogHandle.getCatalogName(), tableMetadata.getTable());
systemSecurityMetadata.columnCreated(session, sourceTableName, column.getName());
}
}

@Override
public void dropColumn(Session session, TableHandle tableHandle, ColumnHandle column)
{
CatalogHandle catalogHandle = tableHandle.getCatalogHandle();
ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle);
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle);
metadata.dropColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), column);
if (catalogMetadata.getSecurityManagement() != CONNECTOR) {
String columnName = getColumnMetadata(session, tableHandle, column).getName();
TableMetadata tableMetadata = getTableMetadata(session, tableHandle);
CatalogSchemaTableName sourceTableName = new CatalogSchemaTableName(catalogHandle.getCatalogName(), tableMetadata.getTable());
systemSecurityMetadata.columnDropped(session, sourceTableName, columnName);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,4 @@ public interface SystemSecurityMetadata
* A table or view was dropped
*/
void tableDropped(Session session, CatalogSchemaTableName table);

/**
* A column was created
*/
void columnCreated(Session session, CatalogSchemaTableName table, String column);

/**
* A column was renamed
*/
void columnRenamed(Session session, CatalogSchemaTableName table, String oldColumn, String newColumn);

/**
* A column was dropped
*/
void columnDropped(Session session, CatalogSchemaTableName table, String column);
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,4 @@ public void tableRenamed(Session session, CatalogSchemaTableName sourceTable, Ca

@Override
public void tableDropped(Session session, CatalogSchemaTableName table) {}

@Override
public void columnCreated(Session session, CatalogSchemaTableName table, String column) {}

@Override
public void columnRenamed(Session session, CatalogSchemaTableName table, String oldColumn, String newColumn) {}

@Override
public void columnDropped(Session session, CatalogSchemaTableName table, String column) {}
}

0 comments on commit 6741a93

Please sign in to comment.