Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void createDatabase() throws Exception {
String dbName2 = "createdb2";
String dbLocationUri = testTempDir;
String dbDescription = "no description";
Database db = new Database(dbName, dbDescription, dbLocationUri, emptyParameters);
Database db = new Database(dbName, dbDescription, "file:" + dbLocationUri, emptyParameters);
db.setOwnerName("test_user");
msClient.createDatabase(db);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public void testRecycleNonPartTable() throws Exception {
db.putToParameters(SOURCE_OF_REPLICATION, "1, 2, 3");
db.setName(dbName);
client.createDatabase(db);
db = client.getDatabase(dbName);

String tblName = "t1";
List<FieldSchema> columns = new ArrayList<FieldSchema>();
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,14 @@ protected A execute() throws TException, IOException {
public String getMessagePrefix() {
throw new UnsupportedOperationException();
}
@Override
public String getRequestProgress() {
throw new UnsupportedOperationException();
}
};
}
}
}
return opHandler;
}

@SuppressWarnings("unchecked")
public static <T extends AbstractRequestHandler> T offer(IHMSHandler handler, TBase req)
throws TException, IOException {
HandlerFactory factory = REQ_FACTORIES.get(req.getClass());
Expand Down Expand Up @@ -235,8 +232,8 @@ public RequestStatus getRequestStatus() throws TException {
// No Op, return to the caller since long polling timeout has expired
LOG.trace("{} Long polling timed out", logMsgPrefix);
} catch (CancellationException e) {
// The background operation thread was cancelled
LOG.trace("{} The background operation was cancelled", logMsgPrefix);
// The background handler thread was cancelled
LOG.trace("{} The background handler was cancelled", logMsgPrefix);
} catch (ExecutionException | InterruptedException e) {
// No op, we will deal with this exception later
LOG.error("{} Failed", logMsgPrefix, e);
Expand Down Expand Up @@ -280,11 +277,12 @@ public void cancelRequest() {
}

/**
* Retrieve the result after this operation is done,
* an IllegalStateException would raise if the operation has not completed.
* @return the operation result
* @throws TException exception while checking the status of the operation
* Retrieve the result after this handler is done,
* an IllegalStateException would raise if the handler has not completed.
* @return the handler's result
* @throws TException exception while checking the status of the handler
*/
@SuppressWarnings("unchecked")
public final A getResult() throws TException {
RequestStatus resp = getRequestStatus();
if (!resp.finished) {
Expand All @@ -295,24 +293,24 @@ public final A getResult() throws TException {
}

/**
* Method invoked prior to executing the given operation.
* This method may be used to initialize and validate the operation.
* Method invoked prior to executing the given handler.
* This method may be used to initialize and validate the handler.
* @throws TException
*/
protected void beforeExecute() throws TException, IOException {
// noop
}

/**
* Run this operation.
* Run this handler.
* @return computed result
* @throws TException if unable to run the operation
* @throws TException if unable to run the handler
* @throws IOException if the request is invalid
*/
protected abstract A execute() throws TException, IOException;

/**
* Method after the operation is done.
* Method after the handler is done.
* Can be used to free the resources this handler holds
*/
protected void afterExecute(A result) throws TException, IOException {
Expand All @@ -321,18 +319,20 @@ protected void afterExecute(A result) throws TException, IOException {
}

/**
* Get the prefix for logging the message on polling the operation status.
* Get the prefix for logging the message on polling the handler's status.
*
* @return message prefix
*/
protected abstract String getMessagePrefix();

/**
* Get the message about the operation progress.
* Get the handler's progress that will show at the client.
*
* @return the progress
*/
protected abstract String getRequestProgress();
protected String getRequestProgress() {
return "Done";
}

public boolean success() throws TException {
RequestStatus status = getRequestStatus();
Expand All @@ -341,7 +341,7 @@ public boolean success() throws TException {

/**
* Get the alias of this handler for metrics.
* @return the alias, null or empty if no need to measure the operation.
* @return the alias, null or empty if no need to measure the handler.
*/
private String getMetricAlias() {
RequestHandler rh = getClass().getAnnotation(RequestHandler.class);
Expand All @@ -366,7 +366,7 @@ interface HandlerFactory {
public interface Result {
/**
* An indicator to tell if the handler is successful or not.
* @return true if the operation is successful, false otherwise
* @return true if the handler is successful, false otherwise
*/
boolean success();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.SetPartitionsStatsRequest;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
import org.apache.hadoop.hive.metastore.client.builder.GetPartitionsArgs;
Expand Down Expand Up @@ -186,7 +187,12 @@ protected AddPartitionsResult execute() throws TException, IOException {
new long[0], new BitSet(), writeId);
validWriteIds = validWriteIdList.toString();
}
((HMSHandler)handler).updatePartitonColStatsInternal(table, null, partColStats, validWriteIds, writeId);
SetPartitionsStatsRequest setPartitionsStatsRequest =
new SetPartitionsStatsRequest(Arrays.asList(partColStats));
setPartitionsStatsRequest.setWriteId(writeId);
setPartitionsStatsRequest.setValidWriteIdList(validWriteIds);
setPartitionsStatsRequest.setNeedMerge(false);
handler.update_partition_column_statistics_req(setPartitionsStatsRequest);
}

success = ms.commitTransaction();
Expand Down Expand Up @@ -541,11 +547,6 @@ protected String getMessagePrefix() {
return "AddPartitionsHandler [" + id + "] - Add partitions for " + tableName + ":";
}

@Override
protected String getRequestProgress() {
return "Adding partitions";
}

public record AddPartitionsResult(boolean success, List<Partition> newParts) implements Result {

}
Expand Down
Loading