gxchain / gxb-core

GXChain Blockchain implementation
https://www.gxchain.org
GNU General Public License v3.0
226 stars 78 forks source link

ES插件在Ubuntu18.04 系统下,存在某些交易类型无法写入到数据库的情况 #193

Closed RootkitKiller closed 4 years ago

RootkitKiller commented 5 years ago

问题描述: 重放区块时,某些交易类型的交易,写入到es数据库时,出现类型不兼容无法写入的错误,报错如下:

java.lang.IllegalArgumentException: mapper [operation_history.op_object.asset_to_issue.amount] of different type, current_type [long], merged_type [text]

问题原因: ES数据库使用mapping来对json字段和值进行映射,存在一种情况,当字段类型为Int64,并且值非常大时,mapping会将该值类型映射为text类型,导致后续插入int64字段时,会报错。

问题代码修复: 适配了报错的相关字段,对这些字段进行了string转换处理。

ES插件需要在使用中,找到问题不断优化,遇到ES插件的问题可以在下面讨论