halo
halo copied to clipboard
将数据库驱动依赖修改为 Reactive
Your current Halo version
2.0.0
Describe this feature
目前数据库驱动是阻塞式的,而如果想要发挥出WebFlux的性能需要从 数据访问层 到 controller 都 reactive,建议将驱动改为响应式的
参考: https://github.com/r2dbc/r2dbc-h2 https://spring.io/projects/spring-data-r2dbc https://github.com/pgjdbc/r2dbc-postgresql

Additional information
/kind improvement /milestone 2.0 /assign @JohnNiang /area core
/priority important-longterm
目前,mssql 和 mariadb r2dbc driver 暂不支持 r2dbc spec 1.0.0,故我们暂时无法支持。请参考:https://github.com/spring-projects/spring-data-relational/commit/ee6c2c89b5c433748b22a79cf40dc8e01142caa3。
不过我们可以持续关注驱动开发动态:https://jira.mariadb.org/browse/R2DBC-60。
替换 JDBC 至 R2DBC 的配置项的变化:
spring:
r2dbc:
# URL 规则请参考:https://r2dbc.io/spec/1.0.0.RELEASE/spec/html/#overview.connection.url
url: r2dbc:h2:file:///${halo.work-dir}/db/halo-next?options=AUTO_SERVER=TRUE;MODE=MySQL
username: admin
password: 123456
sql:
init:
mode: always
platform: h2
我们无需再指定 driver-class-name。
/close
@JohnNiang: Closing this issue.
In response to this:
替换 JDBC 至 R2DBC 的配置项的变化:
spring: r2dbc: # URL 规则请参考:https://r2dbc.io/spec/1.0.0.RELEASE/spec/html/#overview.connection.url url: r2dbc:h2:file:///${halo.work-dir}/db/halo-next?options=AUTO_SERVER=TRUE;MODE=MySQL username: admin password: 123456 sql: init: mode: always platform: h2我们无需再指定
driver-class-name。/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.