Use a different data source class in Canton
Hi Team,
Canton comes with the data source class for PostgresDB dataSourceClass = "org.postgresql.ds.PGSimpleDataSource"and it works well with PostgresDB. A client plans to use PostgresDB on Spanner, which requires some tuning on the class, and a JAR is ready.
May I know if it is possible to use a customised data source class in Canton? If yes, how to do so?
Thanks in advance.
kc
Hello @kctam ,
TL;DR: You can but in this specific example it’s likely that it will not work.
You can specify another data source for Postgres, as shown in the example config here: https://github.com/DACH-NY/canton/blob/main/performance/src/main/console/postgres/persistence.conf#L7
storage {
type = postgres
config {
dataSourceClass = "org.postgresql.ds.PGSimpleDataSource"
properties = {
serverName = ${POSTGRES_HOST}
portNumber = 5432
user = ${POSTGRES_USER}
password = ${POSTGRES_PASSWORD}
}
connectionPool = HikariCP
registerMbeans = true
}
}
For this to work you need to have the corresponding JAR loaded.
Note that any custom data source that would be imported in such a way would not have been tested and is officially unsupported (use at your own risk).
Now, the Postgresql section of the spanner document indicates that only a subset of the sql syntax is supported. My guess is that the current set of supported queries will not be sufficient to run Canton.
Cheers,
Raf
Thanks @Rafael_Guglielmetti for this details!