skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

H2 storage implementation

Open peng-yongsheng opened this issue 8 years ago • 9 comments

Thanks to @chidaodezhongsheng for PR #1347 which is the storage implementation of ShardingJDBC.

ShardingJDBC is using mysql driver based on the SQL grammar. H2 database also supported it by the JDBC API. I prefer use the ShardingJDBC-Storage-DAO instead of current implementation of H2 storage. We can reduce a lot of development and testing for the H2 storage implementation.

Two ways:

  1. H2's DAO extends ShardingJDBC's DAO.
  2. Move ShardingJDBC's DAO into H2's package then make ShardingJDBC's DAO extends H2's DAO

FYI @wu-sheng @chidaodezhongsheng

peng-yongsheng avatar Jun 14 '18 14:06 peng-yongsheng

The question is, whether are ShardingJDBC(MySQL core) and H2 compatible in SQL level?

wu-sheng avatar Jun 14 '18 14:06 wu-sheng

Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL. Original

This is the h2's official description.

peng-yongsheng avatar Jun 14 '18 15:06 peng-yongsheng

We can compare the data type and SQL grammar between ShardingJDBC and H2 first. Then make a decision about this finally.

peng-yongsheng avatar Jun 14 '18 15:06 peng-yongsheng

Shardingjdbc support SQL grammar,not support mysql dialect,for example “case when”.I have checked the sqls In h2 storage,Shardingjdbc not support keyword “or” only.

chidaodezhongsheng avatar Jun 14 '18 15:06 chidaodezhongsheng

My proposal is, evaluate could use shardingjdbc implementor sql in H2, without change required. @chidaodezhongsheng What do you think?

wu-sheng avatar Jun 14 '18 15:06 wu-sheng

Shardingjdbc support SQL grammar,not support mysql dialect,for example “case when”.I have checked the sqls In h2 storage,Shardingjdbc not support keyword “or” only.

So I assume if the SQLs in ShardingSphere implementor, it should also work in H2 implementor. Do you know any risk or problem?

wu-sheng avatar Jun 15 '18 02:06 wu-sheng

I checked the SQLs in H2 implementor, the keyword "or" that Shardingjdbc not support.Besides, it not support read meta data of DB. In Shardingjdbc implementor, I use two sqls instead of the keyword "or". However, I cannot check the column meta data of table, I still not found the instead way.

chidaodezhongsheng avatar Jun 15 '18 03:06 chidaodezhongsheng

If so, I prefer to separate the two implementors, don't depend on that. If compatible is not so good, codes will make people think strange.

wu-sheng avatar Jun 15 '18 04:06 wu-sheng

I have supported H2, MySQL, TiDB in 6-beta release.

wu-sheng avatar Jan 11 '19 02:01 wu-sheng