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

[#4718] fix(iceberg): use unified logic to transform catalog backend name to handle the renaming of catalog #4900

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

FANNG1
Copy link
Contributor

@FANNG1 FANNG1 commented Sep 10, 2024

What changes were proposed in this pull request?

  1. Spark,Trino, Iceberg catalog and Iceberg REST server use getCatalogBackendName to get catalog backend name.
  2. change the default backend name to catalog backend, like jdbc, it will not change after rename.

Why are the changes needed?

Fix: #4718

Does this PR introduce any user-facing change?

Yes

How was this patch tested?

  1. create a jdbc catalog with catalog backend name, check whether can see the schema after rename
  2. create a jdbc catalog without catalog backend name, check whether can see the schema after rename

@FANNG1 FANNG1 marked this pull request as draft September 10, 2024 09:25
@FANNG1 FANNG1 self-assigned this Sep 10, 2024
@FANNG1 FANNG1 changed the title [#4718] fix(iceberg): Catalog backend name handle the renaming of catalog [#4718] fix(iceberg): use unified logic to transform catalog backend name to handle the renaming of catalog Sep 10, 2024
@FANNG1 FANNG1 marked this pull request as ready for review September 10, 2024 11:25
@jerryshao jerryshao requested review from yuqi1129, diqiu50 and theoryxu and removed request for yuqi1129 September 14, 2024 00:26
| `catalog-backend` | Catalog backend of Gravitino Iceberg catalog. Supports `hive` or `jdbc` or `rest`. | (none) | Yes | 0.2.0 |
| `uri` | The URI configuration of the Iceberg catalog. `thrift://127.0.0.1:9083` or `jdbc:postgresql://127.0.0.1:5432/db_name` or `jdbc:mysql://127.0.0.1:3306/metastore_db` or `http://127.0.0.1:9001`. | (none) | Yes | 0.2.0 |
| `warehouse` | Warehouse directory of catalog. `file:///user/hive/warehouse-hive/` for local fs or `hdfs://namespace/hdfs/path` for HDFS. | (none) | Yes | 0.2.0 |
| `catalog-backend-name` | The catalog name passed to underlying Iceberg catalog backend. Catalog name in JDBC backend is used to isolate namespace and tables. | `catalog-backend` property value. | No | 0.5.2 |
Copy link
Contributor

Choose a reason for hiding this comment

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

The default value is "catalog-backend" or "catalog-backend property value".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The property value of catalog-backend, and add an example

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to use only values like catalog-backend?

Copy link
Contributor Author

@FANNG1 FANNG1 Sep 18, 2024

Choose a reason for hiding this comment

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

seems a little odd to use catalog-backend for a catalog name

String catalogBackend = catalogProperties.get(IcebergConstants.CATALOG_BACKEND);
return Optional.ofNullable(catalogBackend)
.map(s -> s.toLowerCase(Locale.ROOT))
.orElse("memory");
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the meaning of the default value `memory"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the default catalog backend is memory

| `catalog-backend` | Catalog backend of Gravitino Iceberg catalog. Supports `hive` or `jdbc` or `rest`. | (none) | Yes | 0.2.0 |
| `uri` | The URI configuration of the Iceberg catalog. `thrift://127.0.0.1:9083` or `jdbc:postgresql://127.0.0.1:5432/db_name` or `jdbc:mysql://127.0.0.1:3306/metastore_db` or `http://127.0.0.1:9001`. | (none) | Yes | 0.2.0 |
| `warehouse` | Warehouse directory of catalog. `file:///user/hive/warehouse-hive/` for local fs or `hdfs://namespace/hdfs/path` for HDFS. | (none) | Yes | 0.2.0 |
| `catalog-backend-name` | The catalog name passed to underlying Iceberg catalog backend. Catalog name in JDBC backend is used to isolate namespace and tables. | The property value of `catalog-backend`, like `jdbc` for JDBC catalog backend. | No | 0.5.2 |

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the default catalog backend memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depondes on catalog-backend, not memory

Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

LGTM

@jerryshao jerryshao merged commit a258a46 into apache:main Sep 23, 2024
26 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 23, 2024
…name to handle the renaming of catalog (#4900)

### What changes were proposed in this pull request?

1. Spark,Trino, Iceberg catalog and Iceberg REST server use
`getCatalogBackendName` to get catalog backend name.
2. change the default backend name to catalog backend, like `jdbc`, it
will not change after rename.

### Why are the changes needed?

Fix: #4718 

### Does this PR introduce _any_ user-facing change?
Yes

### How was this patch tested?
1. create a jdbc catalog with catalog backend name, check whether can
see the schema after rename
1. create a jdbc catalog without catalog backend name, check whether can
see the schema after rename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report] Catalog backend name handle the renaming of catalog
3 participants