polardb / polardbx-engine

polardbx-engine is a MySQL branch originated from Alibaba Group, especially supports large-scale distributed database system.
Other
482 stars 125 forks source link

ERR-CODE: [PXC-4700][ERR_SERVER] server error by null #41

Open Caelebs opened 2 weeks ago

Caelebs commented 2 weeks ago

我业务代码中引入了三方的一个扩展,会自动创建一个视图,在MySQL场景下一切正常,在docker部署的polardb-x中,视图正常创建,但是查询报错。

ERR-CODE: [PXC-4700][ERR_SERVER] server error by null 

这是我的查询SQL,以及对应的视图SQL

SELECT
    * 
FROM
    scheduler_jobrunr_jobs_stats
SELECT COALESCE
    ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` IS NULL ))), 0 ) AS `total`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'SCHEDULED' ))), 0 ) AS `scheduled`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'ENQUEUED' ))), 0 ) AS `enqueued`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'PROCESSING' ))), 0 ) AS `processing`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'FAILED' ))), 0 ) AS `failed`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'SUCCEEDED' ))), 0 ) AS `succeeded`,
    COALESCE ((
        SELECT
            cast(
            cast( `jm`.`value` AS CHAR ( 10 ) charset utf8mb4 ) AS DECIMAL ( 10, 0 )) 
        FROM
            `scheduler_jobrunr_metadata` `jm` 
        WHERE
            ( `jm`.`id` = 'succeeded-jobs-counter-cluster' )),
        0 
    ) AS `allTimeSucceeded`,
    COALESCE ( max(( SELECT `job_stat_results`.`count` FROM DUAL WHERE ( `job_stat_results`.`state` = 'DELETED' ))), 0 ) AS `deleted`,(
    SELECT
        count( 0 ) 
    FROM
        `scheduler_jobrunr_backgroundjobservers` 
        ) AS `nbrOfBackgroundJobServers`,(
    SELECT
        count( 0 ) 
    FROM
        `scheduler_jobrunr_recurring_jobs` 
    ) AS `nbrOfRecurringJobs` 
FROM
    ( SELECT `scheduler_jobrunr_jobs`.`state` AS `state`, count( 0 ) AS `count` FROM `scheduler_jobrunr_jobs` GROUP BY `scheduler_jobrunr_jobs`.`state` WITH ROLLUP ) `job_stat_results`

我测试过rpm部署的polardb,查询是正常的,在rpm部署的polardb中,我通过select @@versionselect version() 的返回一致,都是返回8.0.32-X-Cluster-8.4.19,但是在docker部署的polardb-x中,select version()返回 5.6.29-PXC-5.4.19-SNAPSHOT, select @@version 返回的是8.0.32-X-Cluster-8.4.19,我认为SQL查询时的错误可能会和这个有关系 image image