World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#4881] improvement(docs): Add documents about PostgreSQL storage backend (#4885)
Qi Yu3121f11e565a
diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaSQLProviderFactory.javaindex 632681c5f0..747a47bb18 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaSQLProviderFactory.java@@ -30,7 +30,7 @@ import org.apache.ibatis.annotations.Param;public class CatalogMetaSQLProviderFactory {private static final Map<JDBCBackendType, CatalogMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ CATALOG_META_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new CatalogMetaMySQLProvider(),JDBCBackendType.H2, new CatalogMetaH2Provider(),@@ -44,7 +44,7 @@ public class CatalogMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return CATALOG_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class CatalogMetaMySQLProvider extends CatalogMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetMetaSQLProviderFactory.javaindex b41237e2a7..b0c4fd87a0 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetMetaSQLProviderFactory.java@@ -29,7 +29,7 @@ import org.apache.ibatis.annotations.Param;public class FilesetMetaSQLProviderFactory {private static final Map<JDBCBackendType, FilesetMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ FILESET_META_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new FilesetMetaMySQLProvider(),JDBCBackendType.H2, new FilesetMetaH2Provider(),@@ -43,7 +43,7 @@ public class FilesetMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return FILESET_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class FilesetMetaMySQLProvider extends FilesetMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetVersionSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetVersionSQLProviderFactory.javaindex 4029c2cb05..6483148428 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetVersionSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/FilesetVersionSQLProviderFactory.java@@ -28,7 +28,7 @@ import org.apache.ibatis.annotations.Param;public class FilesetVersionSQLProviderFactory {private static final Map<JDBCBackendType, FilesetVersionBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ FILESET_VERSION_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new FilesetVersionMySQLProvider(),JDBCBackendType.H2, new FilesetVersionH2Provider(),@@ -42,7 +42,7 @@ public class FilesetVersionSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return FILESET_VERSION_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class FilesetVersionMySQLProvider extends FilesetVersionBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupMetaSQLProviderFactory.javaindex 2769bf1d95..97cc87f975 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupMetaSQLProviderFactory.java@@ -27,12 +27,11 @@ import org.apache.gravitino.storage.relational.session.SqlSessionFactoryHelper;import org.apache.ibatis.annotations.Param;public class GroupMetaSQLProviderFactory {- private static final Map<JDBCBackendType, GroupMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new GroupMetaMySQLProvider(),- JDBCBackendType.H2, new GroupMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new GroupMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, GroupMetaBaseSQLProvider> GROUP_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new GroupMetaMySQLProvider(),+ JDBCBackendType.H2, new GroupMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new GroupMetaPostgreSQLProvider());public static GroupMetaBaseSQLProvider getProvider() {String databaseId =@@ -42,7 +41,7 @@ public class GroupMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return GROUP_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class GroupMetaMySQLProvider extends GroupMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupRoleRelSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupRoleRelSQLProviderFactory.javaindex 6d2ff176bd..618c308bab 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupRoleRelSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/GroupRoleRelSQLProviderFactory.java@@ -30,7 +30,7 @@ import org.apache.ibatis.annotations.Param;public class GroupRoleRelSQLProviderFactory {private static final Map<JDBCBackendType, GroupRoleRelBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ GROUP_ROLE_RELATION_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new GroupRoleRelMySQLProvider(),JDBCBackendType.H2, new GroupRoleRelH2Provider(),@@ -44,7 +44,7 @@ public class GroupRoleRelSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return GROUP_ROLE_RELATION_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class GroupRoleRelMySQLProvider extends GroupRoleRelBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/OwnerMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/OwnerMetaSQLProviderFactory.javaindex 8ddf53d5d5..bb8971c827 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/OwnerMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/OwnerMetaSQLProviderFactory.java@@ -28,12 +28,11 @@ import org.apache.ibatis.annotations.Param;public class OwnerMetaSQLProviderFactory {- private static final Map<JDBCBackendType, OwnerMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new OwnerMetaMySQLProvider(),- JDBCBackendType.H2, new OwnerMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new OwnerMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, OwnerMetaBaseSQLProvider> OWNER_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new OwnerMetaMySQLProvider(),+ JDBCBackendType.H2, new OwnerMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new OwnerMetaPostgreSQLProvider());public static OwnerMetaBaseSQLProvider getProvider() {String databaseId =@@ -43,7 +42,7 @@ public class OwnerMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return OWNER_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class OwnerMetaMySQLProvider extends OwnerMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/RoleMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/RoleMetaSQLProviderFactory.javaindex 4159938600..a79665a7e3 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/RoleMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/RoleMetaSQLProviderFactory.java@@ -27,12 +27,11 @@ import org.apache.gravitino.storage.relational.session.SqlSessionFactoryHelper;import org.apache.ibatis.annotations.Param;public class RoleMetaSQLProviderFactory {- private static final Map<JDBCBackendType, RoleMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new RoleMetaMySQLProvider(),- JDBCBackendType.H2, new RoleMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new RoleMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, RoleMetaBaseSQLProvider> ROLE_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new RoleMetaMySQLProvider(),+ JDBCBackendType.H2, new RoleMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new RoleMetaPostgreSQLProvider());public static RoleMetaBaseSQLProvider getProvider() {String databaseId =@@ -42,7 +41,7 @@ public class RoleMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return ROLE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class RoleMetaMySQLProvider extends RoleMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaSQLProviderFactory.javaindex 87f636e61d..7842ee6eaa 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaSQLProviderFactory.java@@ -28,7 +28,7 @@ import org.apache.ibatis.annotations.Param;public class SchemaMetaSQLProviderFactory {private static final Map<JDBCBackendType, SchemaMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ SCHEMA_META_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new SchemaMetaMySQLProvider(),JDBCBackendType.H2, new SchemaMetaH2Provider(),@@ -42,7 +42,7 @@ public class SchemaMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return SCHEMA_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class SchemaMetaMySQLProvider extends SchemaMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SecurableObjectSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SecurableObjectSQLProviderFactory.javaindex da4ddc730a..813fdd52ee 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SecurableObjectSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SecurableObjectSQLProviderFactory.java@@ -30,7 +30,7 @@ import org.apache.ibatis.annotations.Param;public class SecurableObjectSQLProviderFactory {private static final Map<JDBCBackendType, SecurableObjectBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ SECURABLE_OBJECTS_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new SecurableObjectMySQLProvider(),JDBCBackendType.H2, new SecurableObjectH2Provider(),@@ -44,7 +44,7 @@ public class SecurableObjectSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return SECURABLE_OBJECTS_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class SecurableObjectMySQLProvider extends SecurableObjectBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TableMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TableMetaSQLProviderFactory.javaindex 619648c1f5..5ea1a8af44 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TableMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TableMetaSQLProviderFactory.java@@ -28,12 +28,11 @@ import org.apache.ibatis.annotations.Param;public class TableMetaSQLProviderFactory {- private static final Map<JDBCBackendType, TableMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new TableMetaMySQLProvider(),- JDBCBackendType.H2, new TableMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new TableMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, TableMetaBaseSQLProvider> TABLE_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new TableMetaMySQLProvider(),+ JDBCBackendType.H2, new TableMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new TableMetaPostgreSQLProvider());public static TableMetaBaseSQLProvider getProvider() {String databaseId =@@ -43,7 +42,7 @@ public class TableMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return TABLE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class TableMetaMySQLProvider extends TableMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetaSQLProviderFactory.javaindex c9a018c5f2..c85714dde3 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetaSQLProviderFactory.java@@ -29,7 +29,7 @@ import org.apache.ibatis.annotations.Param;public class TagMetaSQLProviderFactory {- private static final Map<JDBCBackendType, TagMetaBaseSQLProvider> METALAKE_META_SQL_PROVIDER_MAP =+ private static final Map<JDBCBackendType, TagMetaBaseSQLProvider> TAG_META_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new TagMetaMySQLProvider(),JDBCBackendType.H2, new TagMetaH2Provider(),@@ -43,7 +43,7 @@ public class TagMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return TAG_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class TagMetaMySQLProvider extends TagMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetadataObjectRelSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetadataObjectRelSQLProviderFactory.javaindex af4522f9d9..ea60f96cc3 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetadataObjectRelSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TagMetadataObjectRelSQLProviderFactory.java@@ -30,7 +30,7 @@ import org.apache.ibatis.annotations.Param;public class TagMetadataObjectRelSQLProviderFactory {private static final Map<JDBCBackendType, TagMetadataObjectRelBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ TAG_METADATA_OBJECT_RELATION_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new TagMetadataObjectRelMySQLProvider(),JDBCBackendType.H2, new TagMetadataObjectRelH2Provider(),@@ -44,7 +44,7 @@ public class TagMetadataObjectRelSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return TAG_METADATA_OBJECT_RELATION_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class TagMetadataObjectRelMySQLProvider extends TagMetadataObjectRelBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TopicMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TopicMetaSQLProviderFactory.javaindex c1c6e2e237..77dfc32437 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TopicMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/TopicMetaSQLProviderFactory.java@@ -29,12 +29,11 @@ import org.apache.ibatis.annotations.Param;public class TopicMetaSQLProviderFactory {- private static final Map<JDBCBackendType, TopicMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new TopicMetaMySQLProvider(),- JDBCBackendType.H2, new TopicMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new TopicMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, TopicMetaBaseSQLProvider> TOPIC_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new TopicMetaMySQLProvider(),+ JDBCBackendType.H2, new TopicMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new TopicMetaPostgreSQLProvider());public static TopicMetaBaseSQLProvider getProvider() {String databaseId =@@ -44,7 +43,7 @@ public class TopicMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return TOPIC_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class TopicMetaMySQLProvider extends TopicMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserMetaSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserMetaSQLProviderFactory.javaindex 2c322db86d..ab49a45422 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserMetaSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserMetaSQLProviderFactory.java@@ -29,12 +29,11 @@ import org.apache.ibatis.annotations.Param;public class UserMetaSQLProviderFactory {- private static final Map<JDBCBackendType, UserMetaBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =- ImmutableMap.of(- JDBCBackendType.MYSQL, new UserMetaMySQLProvider(),- JDBCBackendType.H2, new UserMetaH2Provider(),- JDBCBackendType.POSTGRESQL, new UserMetaPostgreSQLProvider());+ private static final Map<JDBCBackendType, UserMetaBaseSQLProvider> USER_META_SQL_PROVIDER_MAP =+ ImmutableMap.of(+ JDBCBackendType.MYSQL, new UserMetaMySQLProvider(),+ JDBCBackendType.H2, new UserMetaH2Provider(),+ JDBCBackendType.POSTGRESQL, new UserMetaPostgreSQLProvider());public static UserMetaBaseSQLProvider getProvider() {String databaseId =@@ -44,7 +43,7 @@ public class UserMetaSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return USER_META_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class UserMetaMySQLProvider extends UserMetaBaseSQLProvider {}diff --git a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserRoleRelSQLProviderFactory.java b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserRoleRelSQLProviderFactory.javaindex f98f509f8f..a0555192f2 100644--- a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserRoleRelSQLProviderFactory.java+++ b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/UserRoleRelSQLProviderFactory.java@@ -31,7 +31,7 @@ import org.apache.ibatis.annotations.Param;public class UserRoleRelSQLProviderFactory {private static final Map<JDBCBackendType, UserRoleRelBaseSQLProvider>- METALAKE_META_SQL_PROVIDER_MAP =+ USER_ROLE_RELATIONAL_SQL_PROVIDER_MAP =ImmutableMap.of(JDBCBackendType.MYSQL, new UserRoleRelMySQLProvider(),JDBCBackendType.H2, new UserRoleRelH2Provider(),@@ -45,7 +45,7 @@ public class UserRoleRelSQLProviderFactory {.getDatabaseId();JDBCBackendType jdbcBackendType = JDBCBackendType.fromString(databaseId);- return METALAKE_META_SQL_PROVIDER_MAP.get(jdbcBackendType);+ return USER_ROLE_RELATIONAL_SQL_PROVIDER_MAP.get(jdbcBackendType);}static class UserRoleRelMySQLProvider extends UserRoleRelBaseSQLProvider {}diff --git a/docs/gravitino-server-config.md b/docs/gravitino-server-config.mdindex ff45e48a61..4cc1dfe3c2 100644--- a/docs/gravitino-server-config.md+++ b/docs/gravitino-server-config.md@@ -50,20 +50,20 @@ If you are going to use H2 in the production environment, Gravitino will not guaThe following table lists the storage configuration items:-| Configuration item | Description | Default value | Required | Since version |-|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|--------------------------------------------------|---------------|-| `gravitino.entity.store` | Which entity storage implementation to use. Only`relational` storage is currently supported. | `relational` | No | 0.1.0 |-| `gravitino.entity.serde` | The serialization/deserialization class used to support entity storage. `proto' is currently supported. | `proto` | No | 0.1.0 |-| `gravitino.entity.store.maxTransactionSkewTimeMs` | The maximum skew time of transactions in milliseconds. | `2000` | No | 0.3.0 |-| `gravitino.entity.store.kv.deleteAfterTimeMs` | It is deprecated since Gravitino 0.5.0. Please use `gravitino.entity.store.deleteAfterTimeMs` instead. | `604800000`(7 days) | No | 0.3.0 |-| `gravitino.entity.store.deleteAfterTimeMs` | The maximum time in milliseconds that deleted and old-version data is kept. Set to at least 10 minutes and no longer than 30 days. | `604800000`(7 days) | No | 0.5.0 |-| `gravitino.entity.store.versionRetentionCount` | The Count of versions allowed to be retained, including the current version, used to delete old versions data. Set to at least 1 and no greater than 10. | `1` | No | 0.5.0 |-| `gravitino.entity.store.relational` | Detailed implementation of Relational storage. `H2` and `MySQL` is currently supported, and the implementation is `JDBCBackend`. | `JDBCBackend` | No | 0.5.0 |-| `gravitino.entity.store.relational.jdbcUrl` | The database url that the `JDBCBackend` needs to connect to. If you use `MySQL`, you should firstly initialize the database tables yourself by executing the ddl scripts in the `${GRAVITINO_HOME}/scripts/mysql/` directory. | `jdbc:h2` | No | 0.5.0 |-| `gravitino.entity.store.relational.jdbcDriver` | The jdbc driver name that the `JDBCBackend` needs to use. You should place the driver Jar package in the `${GRAVITINO_HOME}/libs/` directory. | `org.h2.Driver` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |-| `gravitino.entity.store.relational.jdbcUser` | The username that the `JDBCBackend` needs to use when connecting the database. It is required for `MySQL`. | `gravitino` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |-| `gravitino.entity.store.relational.jdbcPassword` | The password that the `JDBCBackend` needs to use when connecting the database. It is required for `MySQL`. | `gravitino` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |-| `gravitino.entity.store.relational.storagePath` | The storage path for embedded JDBC storage implementation. It supports both absolute and relative path, if the value is a relative path, the final path is `${GRAVITINO_HOME}/${PATH_YOU_HAVA_SET}`, default value is `${GRAVITINO_HOME}/data/jdbc` | `${GRAVITINO_HOME}/data/jdbc` | No | 0.6.0 |+| Configuration item | Description | Default value | Required | Since version |+|---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|--------------------------------------------------|---------------|+| `gravitino.entity.store` | Which entity storage implementation to use. Only`relational` storage is currently supported. | `relational` | No | 0.1.0 |+| `gravitino.entity.serde` | The serialization/deserialization class used to support entity storage. `proto' is currently supported. | `proto` | No | 0.1.0 |+| `gravitino.entity.store.maxTransactionSkewTimeMs` | The maximum skew time of transactions in milliseconds. | `2000` | No | 0.3.0 |+| `gravitino.entity.store.kv.deleteAfterTimeMs` | It is deprecated since Gravitino 0.5.0. Please use `gravitino.entity.store.deleteAfterTimeMs` instead. | `604800000`(7 days) | No | 0.3.0 |+| `gravitino.entity.store.deleteAfterTimeMs` | The maximum time in milliseconds that deleted and old-version data is kept. Set to at least 10 minutes and no longer than 30 days. | `604800000`(7 days) | No | 0.5.0 |+| `gravitino.entity.store.versionRetentionCount` | The Count of versions allowed to be retained, including the current version, used to delete old versions data. Set to at least 1 and no greater than 10. | `1` | No | 0.5.0 |+| `gravitino.entity.store.relational` | Detailed implementation of Relational storage. `H2`, `MySQL` and `PostgreSQL` is currently supported, and the implementation is `JDBCBackend`. | `JDBCBackend` | No | 0.5.0 |+| `gravitino.entity.store.relational.jdbcUrl` | The database url that the `JDBCBackend` needs to connect to. If you use `MySQL` or `PostgreSQL`, you should firstly initialize the database tables yourself by executing the ddl scripts in the `${GRAVITINO_HOME}/scripts/{DATABASE_TYPE}/` directory. | `jdbc:h2` | No | 0.5.0 |+| `gravitino.entity.store.relational.jdbcDriver` | The jdbc driver name that the `JDBCBackend` needs to use. You should place the driver Jar package in the `${GRAVITINO_HOME}/libs/` directory. | `org.h2.Driver` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |+| `gravitino.entity.store.relational.jdbcUser` | The username that the `JDBCBackend` needs to use when connecting the database. It is required for `MySQL`. | `gravitino` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |+| `gravitino.entity.store.relational.jdbcPassword` | The password that the `JDBCBackend` needs to use when connecting the database. It is required for `MySQL`. | `gravitino` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 |+| `gravitino.entity.store.relational.storagePath` | The storage path for embedded JDBC storage implementation. It supports both absolute and relative path, if the value is a relative path, the final path is `${GRAVITINO_HOME}/${PATH_YOU_HAVA_SET}`, default value is `${GRAVITINO_HOME}/data/jdbc` | `${GRAVITINO_HOME}/data/jdbc` | No | 0.6.0 |:::cautiondiff --git a/docs/how-to-upgrade.md b/docs/how-to-upgrade.mdindex a0873823d9..e463843bb5 100644--- a/docs/how-to-upgrade.md+++ b/docs/how-to-upgrade.md@@ -40,6 +40,13 @@ using the `--host` and `--user` command line switches.The easiest way of accomplishing this task isby creating a copy of the directory containing your database.+#### PostgreSQL+For PostgreSQL, you can use the following command to backup your database:++```shell+pg_dump -U username -h hostname -d database_name -n schema_name -a -F c -f data_backup.sql+```+### Step 3: Dump your Gravitino databaseDump your Gravitino database schema to a file@@ -59,6 +66,12 @@ java -cp h2-1.4.200.jar org.h2.tools.Script -url "jdbc:h2:file:<db_file>;DB_CLOS```Note that you may need to specify your h2 file path, username and password+#### PostgreSQL+For PostgreSQL, you can use the following command to dump the database schema to a file:++```shell+pg_dump -U username -h hostname -d database_name -n schema_name -s -F c -f schema-x.y.z-postgresql.sql+```### Step 4: Determine differences between your schema and the official schemaThe schema upgrade scripts assume that the schema you are upgrading@@ -97,6 +110,15 @@ java -cp h2-1.4.200.jar org.h2.tools.RunScript -url "jdbc:h2:file:<db_file>;DB_Cjava -cp h2-1.4.200.jar org.h2.tools.RunScript -url "jdbc:h2:file:<db_file>;DB_CLOSE_DELAY=-1;MODE=MYSQL" -user <user> -password <password> -script upgrade-0.7.0-to-0.8.0-h2.sql```+#### PostgreSQL+For PostgreSQL, you can use the following command to apply the upgrade script:++```shell+psql -U username -h hostname -d database_name -c "SET search_path TO schema_name;" -f upgrade-0.6.0-to-0.7.0-mysql.sql+psql -U username -h hostname -d database_name -c "SET search_path TO schema_name;" -f upgrade-0.7.0-to-0.8.0-mysql.sql+```++These scripts should run to completion without any errors. If youdo encounter errors you need to analyze the cause and attempt totrace it back to one of the preceding steps.diff --git a/docs/how-to-use-relational-backend-storage.md b/docs/how-to-use-relational-backend-storage.mdindex cc282d9d73..f3be053e71 100644--- a/docs/how-to-use-relational-backend-storage.md+++ b/docs/how-to-use-relational-backend-storage.md@@ -18,9 +18,13 @@ take advantage of relational storage to manage metadata.### What kind of backend storage is supported-Currently, relational backend storage supports the `JDBCBackend`, and `MySQL` and `H2` are supported currently for `JDBCBackend`, `H2` is the+Currently, relational backend storage supports the `JDBCBackend`, and `H2`, `MySQL` and `PostgreSQL` are supported currently for `JDBCBackend`, `H2` is thedefault storage for `JDBCBackend`.+## How to use H2++As mentioned above, `H2` is the default storage for `JDBCBackend`, so you can use `H2` directly without any additional configuration.+## How to use MySQL### Prerequisites@@ -87,6 +91,86 @@ Finally, you can run the script in the distribution package directory to start t./${GRAVITINO_HOME}/bin/gravitino.sh start```-## How to use H2+## How to use PostgreSQL++### Prerequisites++- PostgreSQL 12 ~ 16. For other versions, the community has not tested fully and may not be compatible.+- Gravitino distribution package with version `0.7.0` or above.+- PostgreSQL connector Jar (Should be compatible with the version of PostgreSQL instance).++### Step 1: Get the initialization script++You need to `download` and `unzip` the distribution package firstly, please see+[How to install Gravitino](how-to-install.md).++Then you can get the initialization script in the directory:++```text+${GRAVITINO_HOME}/scripts/postgresql/+```++The script name is like `schema-{version}-postgresql.sql`, and the `version` depends on your Gravitino version.+For example, if your Gravitino version is the latest release version, then you can choose the **latest version** script.+If you used a legacy script, you can use `upgrade-{old version}-to-{new version}-postgresql.sql` to upgrade the schema.++### Step 2: Initialize the database++Please create a database and schema in PostgreSQL in advance, and execute the initialization script obtained above in the database.++```postgresql+psql --username=postgres --password+password:++create database your_database;+\c your_database+create schema your_schema;+set search_path to your_schema;+\i schema-{version}-postgresql.sql+```++:::note+Database and schema are required parameters in the Gravitino PostgreSQL JDBC URL, Users should+create them in advance and set the database and schema in the JDBC URL.+:::+++### Step 3: Place the PostgreSQL connector Jar++You should **download** the PostgreSQL connector Jar for the corresponding version of PostgreSQL you use+(You can download it from the [PostgreSQL-driver-jar](https://jdbc.postgresql.org/download/postgresql-42.7.0.jar)),+which is name like `postgresql-{version}.jar`.++Then please place it in the distribution package directory:++```text+${GRAVITINO_HOME}/libs/+```++### Step 4: Set up the Apache Gravitino server configs++Find the server configuration file which name is `gravitino.conf` in the distribution package directory:++```text+${GRAVITINO_HOME}/conf/+```++Then set up the following server configs:++```text+gravitino.entity.store = relational+gravitino.entity.store.relational = JDBCBackend++## JDBC URL such as: jdbc:postgresql://localhost:5432/your_database?currentSchema=your_schema+gravitino.entity.store.relational.jdbcUrl = ${your_jdbc_url}++## JDBC driver name such as: org.postgresql.Driver+gravitino.entity.store.relational.jdbcDriver = ${your_driver_name}++gravitino.entity.store.relational.jdbcUser = ${your_username}+gravitino.entity.store.relational.jdbcPassword = ${your_password}+```++### Step 5: Start the server-As mentioned above, `H2` is the default storage for `JDBCBackend`, so you can use `H2` directly without any additional configuration.\ No newline at end of file+Please see the above steps in the MySQL section.\ No newline at end of file