I'm trying to use RisingWave with Spring Data R2DBC, but I'm getting a DataAccessResourceFailureException
during startup. The underlying cause seems to be a PostgresqlNonTransientResourceException
with the message 'failed to get tenant identifier'. I've modified the connection string from a working example, and it connects fine with a non-reactive Postgres driver and through DBeaver, but not with the reactive R2DBC driver. Here's the exception stack trace:
Caused by: org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection
at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:90) ~[spring-r2dbc-6.0.4.jar:6.0.4]
...
Caused by: io.r2dbc.postgresql.ExceptionFactory$PostgresqlNonTransientResourceException: failed to get tenant identifier. request id: 504086ef-d29d-4a97-a997-532ab2c2906d
at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:109) ~[r2dbc-postgresql-1.0.0.RELEASE.jar:1.0.0.RELEASE]
...
harshit dwivedi
Asked on Feb 13, 2024
The issue seems to be related to the R2DBC PostgreSQL driver not enabling SNI (Server Name Indication) during SSL handshaking, which is required by RisingWave to detect the tenant ID. A workaround is to use an extended parameter in the connection string that the driver will recognize. An issue was created in the r2dbc-postgresql project to address this, and a fix has been implemented. You can test the fix with the 1.0.5.BUILD-SNAPSHOT
build. Here's how you can update your Maven configuration to use the snapshot version:
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>1.0.5.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
Make sure to also update your connection string accordingly. The community is active, and a new version release is expected soon. Keep an eye on the GitHub issue for updates.