Skip to content

Commit

Permalink
Merge branch 'main' into iceberg-event
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqi1129 authored Oct 21, 2024
2 parents 9a3e988 + 141aa80 commit 6a6eade
Show file tree
Hide file tree
Showing 132 changed files with 4,879 additions and 1,072 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/access-control-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ jobs:
- name: Authorization Integration Test (JDK${{ matrix.java-version }})
id: integrationTest
run: |
./gradlew -PskipTests -PtestMode=embedded -PjdbcBackend=h2 -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.integration.test.**"
./gradlew -PskipTests -PtestMode=deploy -PjdbcBackend=mysql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.integration.test.**"
./gradlew -PskipTests -PtestMode=deploy -PjdbcBackend=postgresql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.integration.test.**"
./gradlew -PtestMode=embedded -PjdbcBackend=h2 -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
./gradlew -PtestMode=deploy -PjdbcBackend=mysql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
./gradlew -PtestMode=deploy -PjdbcBackend=postgresql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
- name: Upload integrate tests reports
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions LICENSE.bin
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
Apache Hadoop
Apache Hadoop Aliyun connector
Apache Hadoop GCS connector
Apache Hadoop AWS connector
Apache Hadoop Annotatations
Apache Hadoop Auth
Apache Hadoop Client Aggregator
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ Please see [How to build Gravitino](docs/how-to-build.md) for details on buildin

## Quick start

### Configure and start the Apache Gravitino server
### Use Gravitino playground

If you already have a binary distribution package, go to the decompressed package directory.
This is the most recommended way: Gravitino provides a docker-compose based playground to quickly experience the whole system together with other components. Clone or download the [Gravitino playground repository](https://github.com/apache/gravitino-playground) and then follow the [README](https://github.com/apache/gravitino-playground/blob/main/README.md), you will have all then.

### Configure and start Gravitino server in local

If you want to start Gravitino in your machine, download a binary package from the [download page](https://gravitino.apache.org/downloads), and then decompressed the package.

Before starting the Gravitino server, please configure the Gravitino server configuration file. The
configuration file, `gravitino.conf`, is in the `conf` directory and follows the standard property file format. You can modify the configuration within this file.
Expand Down
8 changes: 7 additions & 1 deletion api/src/main/java/org/apache/gravitino/MetadataObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ public static MetadataObject parse(String fullName, MetadataObject.Type type) {
return MetadataObjects.of(parts, type);
}

private static String getParentFullName(List<String> names) {
/**
* Get the parent full name of the given full name.
*
* @param names The names of the metadata object
* @return The parent full name if it exists, otherwise null
*/
public static String getParentFullName(List<String> names) {
if (names.size() <= 1) {
return null;
}
Expand Down
3 changes: 3 additions & 0 deletions api/src/main/java/org/apache/gravitino/Metalake.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
@Evolving
public interface Metalake extends Auditable {

/** The property indicating the metalake is in use. */
String PROPERTY_IN_USE = "in-use";

/**
* The name of the metalake.
*
Expand Down
74 changes: 68 additions & 6 deletions api/src/main/java/org/apache/gravitino/SupportsMetalakes.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import java.util.Map;
import org.apache.gravitino.annotation.Evolving;
import org.apache.gravitino.exceptions.MetalakeAlreadyExistsException;
import org.apache.gravitino.exceptions.MetalakeInUseException;
import org.apache.gravitino.exceptions.MetalakeNotInUseException;
import org.apache.gravitino.exceptions.NoSuchMetalakeException;
import org.apache.gravitino.exceptions.NonEmptyEntityException;

/**
* Client interface for supporting metalakes. It includes methods for listing, loading, creating,
Expand All @@ -38,7 +41,7 @@ public interface SupportsMetalakes {
Metalake[] listMetalakes();

/**
* Load a metalake by its identifier.
* Load a metalake by its name.
*
* @param name the name of the metalake.
* @return The metalake.
Expand All @@ -62,7 +65,7 @@ default boolean metalakeExists(String name) {
}

/**
* Create a metalake with specified identifier.
* Create a metalake with specified name, comment and properties.
*
* @param name The name of the metalake.
* @param comment The comment of the metalake.
Expand All @@ -74,7 +77,7 @@ Metalake createMetalake(String name, String comment, Map<String, String> propert
throws MetalakeAlreadyExistsException;

/**
* Alter a metalake with specified identifier.
* Alter a metalake with specified metalake name and changes.
*
* @param name The name of the metalake.
* @param changes The changes to apply.
Expand All @@ -86,10 +89,69 @@ Metalake alterMetalake(String name, MetalakeChange... changes)
throws NoSuchMetalakeException, IllegalArgumentException;

/**
* Drop a metalake with specified identifier.
* Drop a metalake with specified name. Please make sure:
*
* @param name The identifier of the metalake.
* <ul>
* <li>There is no catalog in the metalake. Otherwise, a {@link NonEmptyEntityException} will be
* thrown.
* <li>The method {@link #disableMetalake(String)} has been called before dropping the metalake.
* Otherwise, a {@link MetalakeInUseException} will be thrown.
* </ul>
*
* It is equivalent to calling {@code dropMetalake(name, false)}.
*
* @param name The name of the metalake.
* @return True if the metalake was dropped, false if the metalake does not exist.
* @throws NonEmptyEntityException If the metalake is not empty.
* @throws MetalakeInUseException If the metalake is in use.
*/
default boolean dropMetalake(String name) throws NonEmptyEntityException, MetalakeInUseException {
return dropMetalake(name, false);
}

/**
* Drop a metalake with specified name. If the force flag is true, it will:
*
* <ul>
* <li>Cascade drop all sub-entities (tags, catalogs, schemas, tables, etc.) of the metalake in
* Gravitino store.
* <li>Drop the metalake even if it is in use.
* <li>External resources (e.g. database, table, etc.) associated with sub-entities will not be
* deleted unless it is managed (such as managed fileset).
* </ul>
*
* If the force flag is false, it is equivalent to calling {@link #dropMetalake(String)}.
*
* @param name The name of the metalake.
* @param force Whether to force the drop.
* @return True if the metalake was dropped, false if the metalake does not exist.
* @throws NonEmptyEntityException If the metalake is not empty and force is false.
* @throws MetalakeInUseException If the metalake is in use and force is false.
*/
boolean dropMetalake(String name, boolean force)
throws NonEmptyEntityException, MetalakeInUseException;

/**
* Enable a metalake. If the metalake is already in use, this method does nothing.
*
* @param name The name of the metalake.
* @throws NoSuchMetalakeException If the metalake does not exist.
*/
void enableMetalake(String name) throws NoSuchMetalakeException;

/**
* Disable a metalake. If the metalake is already disabled, this method does nothing. Once a
* metalake is disable:
*
* <ul>
* <li>It can only be listed, loaded, dropped, or enable.
* <li>Any other operations on the metalake will throw an {@link MetalakeNotInUseException}.
* <li>Any operation on the sub-entities (catalogs, schemas, tables, etc.) will throw an {@link
* MetalakeNotInUseException}.
* </ul>
*
* @param name The name of the metalake.
* @throws NoSuchMetalakeException If the metalake does not exist.
*/
boolean dropMetalake(String name);
void disableMetalake(String name) throws NoSuchMetalakeException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.exceptions;

import com.google.errorprone.annotations.FormatMethod;
import com.google.errorprone.annotations.FormatString;

/** Exception thrown when a metalake is in use and cannot be deleted. */
public class MetalakeInUseException extends InUseException {
/**
* Constructs a new exception with the specified detail message.
*
* @param message the detail message.
* @param args the arguments to the message.
*/
@FormatMethod
public MetalakeInUseException(@FormatString String message, Object... args) {
super(message, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.exceptions;

import com.google.errorprone.annotations.FormatMethod;
import com.google.errorprone.annotations.FormatString;

/** An exception thrown when operating on a metalake that is not in use. */
public class MetalakeNotInUseException extends NotInUseException {
/**
* Constructs a new exception with the specified detail message.
*
* @param message the detail message.
* @param args the arguments to the message.
*/
@FormatMethod
public MetalakeNotInUseException(@FormatString String message, Object... args) {
super(message, args);
}
}
Loading

0 comments on commit 6a6eade

Please sign in to comment.