@@ -286,20 +286,26 @@ public void executeFateOperation(TInfo tinfo, TCredentials c, long opid, FateOpe
286
286
keepOffline = Boolean .parseBoolean (ByteBufferUtil .toString (arguments .get (2 )));
287
287
}
288
288
289
+ NamespaceId srcNamespaceId ;
289
290
NamespaceId namespaceId ;
290
291
try {
292
+ srcNamespaceId = manager .getContext ().getNamespaceId (srcTableId );
291
293
namespaceId = Namespaces .getNamespaceId (manager .getContext (),
292
294
TableNameUtil .qualify (tableName ).getFirst ());
293
295
} catch (NamespaceNotFoundException e ) {
294
296
// shouldn't happen, but possible once cloning between namespaces is supported
295
297
throw new ThriftTableOperationException (null , tableName , tableOp ,
296
298
TableOperationExceptionType .NAMESPACE_NOTFOUND , "" );
299
+ } catch (TableNotFoundException e ) {
300
+ // shouldn't happen, but possible once cloning between namespaces is supported
301
+ throw new ThriftTableOperationException (srcTableId .canonical (), null , tableOp ,
302
+ TableOperationExceptionType .NOTFOUND , "" );
297
303
}
298
304
299
305
final boolean canCloneTable ;
300
306
try {
301
307
canCloneTable =
302
- manager .security .canCloneTable (c , srcTableId , tableName , namespaceId , namespaceId );
308
+ manager .security .canCloneTable (c , srcTableId , tableName , namespaceId , srcNamespaceId );
303
309
} catch (ThriftSecurityException e ) {
304
310
throwIfTableMissingSecurityException (e , srcTableId , null , TableOperation .CLONE );
305
311
throw e ;
@@ -336,9 +342,9 @@ public void executeFateOperation(TInfo tinfo, TCredentials c, long opid, FateOpe
336
342
goalMessage += " and keep offline." ;
337
343
}
338
344
339
- manager .fate ().seedTransaction (
340
- op . toString (), opid , new TraceRepo <>(new CloneTable (c .getPrincipal (), namespaceId ,
341
- srcTableId , tableName , propertiesToSet , propertiesToExclude , keepOffline )),
345
+ manager .fate ().seedTransaction (op . toString (), opid ,
346
+ new TraceRepo <>(new CloneTable (c .getPrincipal (), srcNamespaceId , srcTableId ,
347
+ namespaceId , tableName , propertiesToSet , propertiesToExclude , keepOffline )),
342
348
autoCleanup , goalMessage );
343
349
344
350
break ;
0 commit comments