Skip to content

Commit

Permalink
Change Arctic to Amoro for thrift name in module core (#2801)
Browse files Browse the repository at this point in the history
Co-authored-by: ZhouJinsong <zhoujinsong0505@163.com>
  • Loading branch information
zhongqishang and zhoujinsong committed May 14, 2024
1 parent eabf74e commit bb8be9d
Show file tree
Hide file tree
Showing 41 changed files with 581 additions and 582 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.amoro.optimizer.common;

import org.apache.amoro.ErrorCodes;
import org.apache.amoro.api.ArcticException;
import org.apache.amoro.api.AmoroException;
import org.apache.amoro.api.OptimizingService;
import org.apache.amoro.client.OptimizingClientPools;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
Expand Down Expand Up @@ -66,8 +66,8 @@ protected <T> T callAms(AmsCallOperation<T> operation) throws TException {
}

private boolean shouldRetryLater(Throwable t) {
if (t instanceof ArcticException) {
ArcticException arcticException = (ArcticException) t;
if (t instanceof AmoroException) {
AmoroException arcticException = (AmoroException) t;
// Call ams again when got a persistence/undefined error
return ErrorCodes.PERSISTENCE_ERROR_CODE == arcticException.getErrorCode()
|| ErrorCodes.UNDEFINED_ERROR_CODE == arcticException.getErrorCode();
Expand All @@ -94,9 +94,8 @@ protected <T> T callAuthenticatedAms(AmsAuthenticatedCallOperation<T> operation)
try {
return operation.call(OptimizingClientPools.getClient(config.getAmsUrl()), token);
} catch (Throwable t) {
if (t instanceof ArcticException
&& ErrorCodes.PLUGIN_RETRY_AUTH_ERROR_CODE
== ((ArcticException) (t)).getErrorCode()) {
if (t instanceof AmoroException
&& ErrorCodes.PLUGIN_RETRY_AUTH_ERROR_CODE == ((AmoroException) (t)).getErrorCode()) {
// Reset the token when got a authorization error
LOG.error(
"Got a authorization error while calling ams, reset token and wait for a new one",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.amoro.optimizer.common;

import org.apache.amoro.ErrorCodes;
import org.apache.amoro.api.ArcticException;
import org.apache.amoro.api.AmoroException;
import org.apache.amoro.api.OptimizerProperties;
import org.apache.amoro.api.OptimizerRegisterInfo;
import org.apache.iceberg.relocated.com.google.common.collect.Maps;
Expand Down Expand Up @@ -93,8 +93,8 @@ private boolean checkToken() {
return true;
} catch (TException e) {
LOG.error("Register optimizer to ams failed", e);
if (e instanceof ArcticException
&& ErrorCodes.FORBIDDEN_ERROR_CODE == ((ArcticException) e).getErrorCode()) {
if (e instanceof AmoroException
&& ErrorCodes.FORBIDDEN_ERROR_CODE == ((AmoroException) e).getErrorCode()) {
System.exit(1); // Don't need to try again
}
return false;
Expand All @@ -112,8 +112,8 @@ private void touch() {
});
LOG.debug("Optimizer[{}] touch ams", getToken());
} catch (TException e) {
if (e instanceof ArcticException
&& ErrorCodes.PLUGIN_RETRY_AUTH_ERROR_CODE == ((ArcticException) e).getErrorCode()) {
if (e instanceof AmoroException
&& ErrorCodes.PLUGIN_RETRY_AUTH_ERROR_CODE == ((AmoroException) e).getErrorCode()) {
setToken(null);
LOG.error("Got authorization error from ams, try to register later", e);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.javalin.Javalin;
import io.javalin.http.HttpCode;
import org.apache.amoro.Constants;
import org.apache.amoro.api.ArcticTableMetastore;
import org.apache.amoro.api.AmoroTableMetastore;
import org.apache.amoro.api.OptimizerProperties;
import org.apache.amoro.api.OptimizingService;
import org.apache.amoro.api.config.ConfigHelpers;
Expand Down Expand Up @@ -286,10 +286,10 @@ private void initThriftService() throws TTransportException {
serviceConfig.getInteger(ArcticManagementConf.THRIFT_QUEUE_SIZE_PER_THREAD);
String bindHost = serviceConfig.getString(ArcticManagementConf.SERVER_BIND_HOST);

ArcticTableMetastore.Processor<ArcticTableMetastore.Iface> tableManagementProcessor =
new ArcticTableMetastore.Processor<>(
AmoroTableMetastore.Processor<AmoroTableMetastore.Iface> tableManagementProcessor =
new AmoroTableMetastore.Processor<>(
ThriftServiceProxy.createProxy(
ArcticTableMetastore.Iface.class,
AmoroTableMetastore.Iface.class,
new TableManagementService(tableService),
ArcticRuntimeException::normalizeCompatibly));
tableManagementServer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.amoro.server;

import org.apache.amoro.TableFormat;
import org.apache.amoro.api.ArcticTableMetastore;
import org.apache.amoro.api.AmoroTableMetastore;
import org.apache.amoro.api.BlockableOperation;
import org.apache.amoro.api.Blocker;
import org.apache.amoro.api.CatalogMeta;
Expand All @@ -38,7 +38,7 @@
import java.util.Map;
import java.util.stream.Collectors;

public class TableManagementService implements ArcticTableMetastore.Iface {
public class TableManagementService implements AmoroTableMetastore.Iface {

private final TableService tableService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.amoro.server.exception;

import org.apache.amoro.ErrorCodes;
import org.apache.amoro.api.ArcticException;
import org.apache.amoro.api.AmoroException;
import org.apache.amoro.api.InvalidObjectException;
import org.apache.amoro.api.MetaException;
import org.apache.amoro.api.NoSuchObjectException;
Expand Down Expand Up @@ -91,8 +91,8 @@ public String getErrorName() {
return errorName;
}

private ArcticException transform() {
return new ArcticException(errorCode, errorName, getMessage());
private AmoroException transform() {
return new AmoroException(errorCode, errorName, getMessage());
}

protected static String getObjectName(TableIdentifier tableIdentifier) {
Expand All @@ -113,7 +113,7 @@ protected static String getObjectName(ServerTableIdentifier tableIdentifier) {
+ tableIdentifier.getTableName();
}

public static ArcticException normalize(Throwable throwable) {
public static AmoroException normalize(Throwable throwable) {
return wrap(throwable).transform();
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb8be9d

Please sign in to comment.