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

[issue-47] Better replica-check exception message #48

Merged
merged 1 commit into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# TBD
### Changed
* Clearer replica-check exception message. See [#47](https://github.com/HotelsDotCom/circus-train/issues/47).

# 11.3.0 - 2018-02-27
### Changed
* SNS message now indicates if message was truncated. See [#41](https://github.com/HotelsDotCom/circus-train/issues/41).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2017 Expedia Inc.
* Copyright (C) 2016-2018 Expedia Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,17 +19,23 @@
import org.apache.hadoop.hive.metastore.api.Table;

import com.hotels.bdp.circustrain.api.CircusTrainException;
import com.hotels.bdp.circustrain.api.CircusTrainTableParameter;

public class DestinationNotReplicaException extends CircusTrainException {

private static final long serialVersionUID = 1L;

DestinationNotReplicaException(Table oldReplicaTable, String replicaMetastoreUris) {
DestinationNotReplicaException(
Table oldReplicaTable,
String replicaMetastoreUris,
CircusTrainTableParameter tableParameter) {
super("Found an existing table '"
+ Warehouse.getQualifiedName(oldReplicaTable)
+ "' in '"
+ replicaMetastoreUris
+ "', but it does not appear to be a replica!");
+ "', but it does not appear to be a replica! Missing table property '"
+ tableParameter.parameterName()
+ "'");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.hotels.bdp.circustrain.api.ReplicaLocationManager;
import com.hotels.bdp.circustrain.api.SourceLocationManager;
import com.hotels.bdp.circustrain.api.event.ReplicaCatalogListener;
import com.hotels.bdp.circustrain.api.listener.HousekeepingListener;
import com.hotels.bdp.circustrain.api.metastore.CloseableMetaStoreClient;
import com.hotels.bdp.circustrain.api.metastore.MetaStoreClientException;
import com.hotels.bdp.circustrain.core.HiveEndpoint;
Expand All @@ -60,7 +61,6 @@
import com.hotels.bdp.circustrain.core.conf.TableReplication;
import com.hotels.bdp.circustrain.core.event.EventUtils;
import com.hotels.bdp.circustrain.core.metastore.LocationUtils;
import com.hotels.bdp.circustrain.api.listener.HousekeepingListener;

public class Replica extends HiveEndpoint {

Expand Down Expand Up @@ -297,7 +297,8 @@ private void determinValidityOfReplica(ReplicationMode replicationMode, Table ol
// REPLICATION_EVENT to determine if a table was created via CT.
String previousEvent = oldReplicaTable.getParameters().get(REPLICATION_EVENT.parameterName());
if (StringUtils.isBlank(previousEvent)) {
throw new DestinationNotReplicaException(oldReplicaTable, getHiveConf().getVar(ConfVars.METASTOREURIS));
throw new DestinationNotReplicaException(oldReplicaTable, getHiveConf().getVar(ConfVars.METASTOREURIS),
REPLICATION_EVENT);
}
LOG.debug("Checking that replication modes are compatible.");
Optional<ReplicationMode> replicaReplicationMode = Enums.getIfPresent(ReplicationMode.class,
Expand Down