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

[Bug] test suite test_table_options may cause NPE in FE #39457

Closed
2 tasks done
wangbo opened this issue Aug 16, 2024 · 1 comment · Fixed by #39509
Closed
2 tasks done

[Bug] test suite test_table_options may cause NPE in FE #39457

wangbo opened this issue Aug 16, 2024 · 1 comment · Fixed by #39509

Comments

@wangbo
Copy link
Contributor

wangbo commented Aug 16, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

master

Problem

Exception in query_p0/system/test_table_options.groovy(line 184):

            "store_row_column" = "true",
            "row_store_page_size" = "8190"
        );
    """

    qt_select_check_1 """select * from information_schema.table_options where table_schema=\"${dbName}\" order by TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,TABLE_MODEL,TABLE_MODEL_KEY,DISTRIBUTE_KEY,DISTRIBUTE_TYPE,BUCKETS_NUM,PARTITION_NUM; """
    sql """
        drop table test_row_column_page_size2;
    """    
    qt_select_check_2 """select * from information_schema.table_options where table_schema=\"${dbName}\" order by TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,TABLE_MODEL,TABLE_MODEL_KEY,DISTRIBUTE_KEY,DISTRIBUTE_TYPE,BUCKETS_NUM,PARTITION_NUM; """
^^^^^^^^^^^^^^^^^^^^^^^^^^ERROR LINE^^^^^^^^^^^^^^^^^^^^^^^^^^

    def user = "table_options_user"
    sql "DROP USER IF EXISTS ${user}"
    sql "CREATE USER ${user} IDENTIFIED BY '123abc!@#'"
    //cloud-mode
    if (isCloudMode()) {
        def clusters = sql " SHOW CLUSTERS; "
        assertTrue(!clusters.isEmpty())
        def validCluster = clusters[0][0]
        sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user}""";

Exception:
java.sql.SQLException: errCode = 2, detailMessage = (172.16.0.77)[INTERNAL_ERROR]TStatus: Cannot invoke "org.apache.doris.catalog.DatabaseIf.getTables()" because "database" is null
  at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
  at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
  at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371)
  at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
  at org.apache.doris.regression.util.JdbcUtils$_executeToStringList_closure3.doCall(JdbcUtils.groovy:95)
  at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
  at org.codehau

Test test_table_options.groovy failed because of NPE in FE.
catalog.getDbNullable(dbId); may return null when DB is dropped
SchemaTablePropertiesScanner first fetch all DB in BE, then get data from FE by DB one by one, when DB is droppped, then NPE happens, so FE should deal the case that a DB name exits in BE but it's dropped already in FE.

regression test link:
http://43.132.222.7:8111/buildConfiguration/Doris_DorisRegression_P0Regression/506268?expandBuildDeploymentsSection=false&hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandPull+Request+Details=true&expandBuildTestsSection=true&expandBuildChangesSection=true

Code of Conduct

@Vallishp
Copy link
Contributor

I will check it

yiguolei pushed a commit that referenced this issue Aug 19, 2024
## Proposed changes

Issue Number: close  #39457

If database is delete then FE should check and return OK with empty set
to BE, so that BE can continue the scan other database id

Unit testing:
stubbed BE to add a invalid database id in the begin of the
dbresult.dbids and reproduced this issue.
mysql> select * from information_schema.table_options;
ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INTERNAL_ERROR]TStatus: Cannot invoke
"org.apache.doris.catalog.DatabaseIf.getTables()" because "database" is
null
mysql> select * from information_schema.table_properties;
ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INTERNAL_ERROR]TStatus: Cannot invoke
"org.apache.doris.catalog.DatabaseIf.getTables()" because "database" is
null
mysql> 
After fix in FE both table query success with invalid dbid from BE.
*************************** 776. row ***************************
  TABLE_CATALOG: internal
   TABLE_SCHEMA: regression_test_tpch_unique_sql_zstd_bucket1_p0
     TABLE_NAME: partsupp
    TABLE_MODEL: UNI
TABLE_MODEL_KEY: PS_PARTKEY,PS_SUPPKEY
 DISTRIBUTE_KEY: PS_PARTKEY
DISTRIBUTE_TYPE: HASH
    BUCKETS_NUM: 1
  PARTITION_NUM: 1
776 rows in set (0.11 sec)

mysql> 

Both table can query even if in the begining there is a invalid dbid in
BE list.
Vallishp added a commit to Vallishp/doris that referenced this issue Aug 21, 2024
wangbo pushed a commit to wangbo/incubator-doris that referenced this issue Aug 28, 2024
yiguolei pushed a commit that referenced this issue Aug 28, 2024
…39457 (#39509) (#40018)

## Proposed changes

pick #39509

Co-authored-by: Vallish Pai <vallishpai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants