benchmark装载数据报错ERROR: Protocol error. Session setup failed
问题现象
在使用benchmark装载数据时,启动执行命令时报如下错误ERROR: Protocol error. Session setup failed.
[root@wang run]# ./runDatabaseBuild.sh props.pg
# ------------------------------------------------------------
# Loading SQL file ./sql.common/tableCreates.sql
# ------------------------------------------------------------
Apr 23, 2024 3:57:37 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [b8377b71-ba17-477f-97b2-a729fdea90f5] Try to connect. IP: 192.168.181.90:5432
Protocol error. Session setup failed.
Starting BenchmarkSQL LoadData
driver=org.postgresql.Driver
conn=jdbc:postgresql://192.168.181.90:5432/testdb
user=test
password=***********
warehouses=1
loadWorkers=4
fileLocation (not defined)
csvNullValue (not defined - using default 'NULL')
Apr 23, 2024 3:57:37 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [cf04f8ab-f727-4ae2-92ac-a337a4537340] Try to connect. IP: 192.168.181.90:5432
ERROR: Protocol error. Session setup failed.
# ------------------------------------------------------------
# Loading SQL file ./sql.common/indexCreates.sql
# ------------------------------------------------------------
Apr 23, 2024 3:57:37 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [8e79b276-e832-43a2-b189-83683732fab8] Try to connect. IP: 192.168.181.90:5432
Protocol error. Session setup failed.
# ------------------------------------------------------------
# Loading SQL file ./sql.common/foreignKeys.sql
# ------------------------------------------------------------
Apr 23, 2024 3:57:37 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [033cc430-a2d9-4891-95b5-5ae8eb7c5337] Try to connect. IP: 192.168.181.90:5432
Protocol error. Session setup failed.
# ------------------------------------------------------------
# Loading SQL file ./sql.postgres/extraHistID.sql
# ------------------------------------------------------------
Apr 23, 2024 3:57:38 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [31b5b3bd-a8f2-4f80-936d-d10254cb0c45] Try to connect. IP: 192.168.181.90:5432
Protocol error. Session setup failed.
# ------------------------------------------------------------
# Loading SQL file ./sql.postgres/buildFinish.sql
# ------------------------------------------------------------
Apr 23, 2024 3:57:38 PM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
INFO: [e649c2fe-d196-48f0-9810-eed6f2f9d26a] Try to connect. IP: 192.168.181.90:5432
Protocol error. Session setup failed.
问题定位与分析
根据报错信息中的关键信息 Protocol error及tableCreates.sql未执行成功,判断可能是benchmark与PG数据库建立连接的时候出问题了。由于是Protocol error,因此排查方向基本就是驱动包及benchmark的问题。这个时候就想到了,目前使用PG的驱动和benchmark编译代码是之前测试openGauss的时候编译的代码,自己潜意识的认为是可以兼容使用的。那么我就先尝试替换驱动,重新编译。
问题处理
在下载最新的pg15对应的驱动后,替换旧的驱动并重新编译benchmark,再次执行runDatabaseBuild.sh脚本,成功建立连接。
问题总结
这个问题其实挺简单,造成最主要的原因还是自己对于PG数据库和openGauss数据库兼容性认知有问题,由于openGauss是基于pg9.2开发驱动版本比较低,但是使用低版本编译的benchmark连接高版本PG15数据库,导致无法连接到数据库。