[ 
https://issues.apache.org/jira/browse/IMPALA-13631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17908078#comment-17908078
 ] 

Quanlong Huang commented on IMPALA-13631:
-----------------------------------------

Jstack of the blocked alterTableOrViewRename() thread:
{noformat}
"Thread-68953 [ALTER_TABLE my_db.my_tbl issued by my_user]" #994672 prio=5 
os_prio=0 cpu=14386.18ms elapsed=863133.04s tid=0x0000000037611000 nid=0xbc00f 
runnable  [0x00007f1c5b54b000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0([email protected]/Native 
Method)
        at 
java.net.SocketInputStream.socketRead([email protected]/SocketInputStream.java:115)
        at 
java.net.SocketInputStream.read([email protected]/SocketInputStream.java:168)
        at 
java.net.SocketInputStream.read([email protected]/SocketInputStream.java:140)
        at 
java.io.BufferedInputStream.fill([email protected]/BufferedInputStream.java:252)
        at 
java.io.BufferedInputStream.read1([email protected]/BufferedInputStream.java:292)
        at 
java.io.BufferedInputStream.read([email protected]/BufferedInputStream.java:351)
        - locked <0x00007f2d89309500> (a java.io.BufferedInputStream)
        at 
org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:177)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:109)
        at 
org.apache.thrift.transport.TSaslTransport.readLength(TSaslTransport.java:338)
        at 
org.apache.thrift.transport.TSaslTransport.readFrame(TSaslTransport.java:421)
        at 
org.apache.thrift.transport.TSaslTransport.read(TSaslTransport.java:397)
        at 
org.apache.thrift.transport.TSaslClientTransport.read(TSaslClientTransport.java:39)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:109)
        at 
org.apache.hadoop.hive.metastore.security.TFilterTransport.readAll(TFilterTransport.java:63)
        at 
org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:464)
        at 
org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:362)
        at 
org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:245)
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:77)
        at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_alter_table_req(ThriftHiveMetastore.java:2752)
        at 
org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.alter_table_req(ThriftHiveMetastore.java:2739)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.alter_table_with_environmentContext(HiveMetaStoreClient.java:465)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.alter_table(HiveMetaStoreClient.java:438)
        at jdk.internal.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
        at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke([email protected]/Method.java:566)
        at 
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:209)
        at com.sun.proxy.$Proxy34.alter_table(Unknown Source)
        at 
org.apache.impala.service.CatalogOpExecutor.alterTableOrViewRename(CatalogOpExecutor.java:5365)
        at 
org.apache.impala.service.CatalogOpExecutor.alterTable(CatalogOpExecutor.java:1085)
        at 
org.apache.impala.service.CatalogOpExecutor.execDdlRequest(CatalogOpExecutor.java:453)
        at 
org.apache.impala.service.JniCatalog.lambda$execDdl$3(JniCatalog.java:302)
        at 
org.apache.impala.service.JniCatalog$$Lambda$239/0x00007f1d47e5fcb0.call(Unknown
 Source)
        at 
org.apache.impala.service.JniCatalogOp.lambda$execAndSerialize$1(JniCatalogOp.java:90)
        at 
org.apache.impala.service.JniCatalogOp$$Lambda$214/0x00007f1d569138b0.call(Unknown
 Source)
        at org.apache.impala.service.JniCatalogOp.execOp(JniCatalogOp.java:58)
        at 
org.apache.impala.service.JniCatalogOp.execAndSerialize(JniCatalogOp.java:89)
        at 
org.apache.impala.service.JniCatalogOp.execAndSerialize(JniCatalogOp.java:100)
        at 
org.apache.impala.service.JniCatalog.execAndSerialize(JniCatalog.java:231)
        at 
org.apache.impala.service.JniCatalog.execAndSerialize(JniCatalog.java:245)
        at 
org.apache.impala.service.JniCatalog.execDdl(JniCatalog.java:301){noformat}

getPartialCatalogObject threads will be blocked when reading a db at
https://github.com/apache/impala/blob/0bbd2b684ddc7dcf8b6c16f1f7c6fab15291f782/fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java#L3857

getPartialCatalogObject threads will also be blocked when reading a table at
https://github.com/apache/impala/blob/0bbd2b684ddc7dcf8b6c16f1f7c6fab15291f782/fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java#L3884
https://github.com/apache/impala/blob/0bbd2b684ddc7dcf8b6c16f1f7c6fab15291f782/fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java#L2469

> alterTableOrViewRename shouldn't hold catalogVersionLock during external RPCs
> -----------------------------------------------------------------------------
>
>                 Key: IMPALA-13631
>                 URL: https://issues.apache.org/jira/browse/IMPALA-13631
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Catalog
>            Reporter: Quanlong Huang
>            Assignee: Quanlong Huang
>            Priority: Major
>
> CatalogOpExecutor.alterTableOrViewRename() requires holding the 
> catalogVersion writeLock, as the comment mentioned:
> {code:java}
>         // RENAME is implemented as an ADD + DROP, so we need to execute it 
> as we hold
>         // the catalog lock.
>         try {
>           alterTableOrViewRename(tbl,
>               
> TableName.fromThrift(params.getRename_params().getNew_table_name()),
>               modification, wantMinimalResult, response, catalogTimeline);
>           modification.validateInProgressModificationComplete();
>           return;
>         } finally {
>           // release the version taken in the tryLock call above
>           catalog_.getLock().writeLock().unlock();
>         } {code}
> https://github.com/apache/impala/blob/0bbd2b684ddc7dcf8b6c16f1f7c6fab15291f782/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java#L1221-L1232
> However, alterTableOrViewRename() triggers external RPCs, e.g. HMS 
> alter_table RPC, which could hang due to external issues. Holding the 
> catalogVersion writeLock blocks all other catalog operations, including all 
> the read requests like getPartialCatalogObject or collecting catalog updates. 
> This will impact the whole Impala cluster. Lots of queries will be blocked in 
> the CREATED state.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to