polaris-contrib / store-postgresql

在 Polaris 中提供基于 postgresql 实现的存储层
Other
4 stars 1 forks source link

导入polaris_server.sql 后启动服务失败,字段类型不兼容 #2

Open pemako opened 1 year ago

pemako commented 1 year ago
[ERROR] register polaris service fail: store layer exception: getService err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported

# polaris-cache-error.log
2023-07-18T11:12:35.777051Z error   cache   cache/service.go:192    [Cache][Service] update services err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported

# polaris-default-error.log
2023-07-18T11:12:35.776558Z error   postgresql/service.go:1098  [Store][database] fetch service rows scan err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.776908Z error   postgresql/service.go:864   [Store][database] call fetch service rows err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.776964Z error   postgresql/service.go:755   [Store][database] get more service main err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.777004Z error   postgresql/service.go:405   [Store][database] get more service+meta err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.785119Z error   postgresql/service.go:1098  [Store][database] fetch service rows scan err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.786578Z error   bootstrap/server.go:544 self register err: store layer exception: getService err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported

#  polaris-default.log
2023-07-18T11:12:35.640475Z info    bootstrap/server.go:490 [Bootstrap] get local host: 127.0.0.1
2023-07-18T11:12:35.740330Z info    postgresql/base_db.go:100   [Store][database] db set conn max life time: 300
2023-07-18T11:12:35.744784Z info    postgresql/base_db.go:100   [Store][database] db set conn max life time: 300
2023-07-18T11:12:35.744840Z info    postgresql/default.go:126   [Store][database] connect the database successfully
2023-07-18T11:12:35.744890Z info    bootstrap/server.go:388 [Bootstrap] get bootstrap order config: map[key:sz open:true]
2023-07-18T11:12:35.744907Z info    bootstrap/server.go:396 bootstrap start in order with key: sz
2023-07-18T11:12:35.746952Z info    postgresql/transaction.go:67    [Store][database] get rand int: 730
2023-07-18T11:12:35.746991Z info    postgresql/transaction.go:70    [Store][database] update start lock_id: 1, lock_key: sz, lock server: 127.0.0.1
2023-07-18T11:12:35.747517Z info    bootstrap/server.go:429 lock bootstrap success
2023-07-18T11:12:35.756304Z info    postgresql/admin.go:350 [Store][database] change from leader to follower (polaris.checker)
2023-07-18T11:12:35.756357Z info    postgresql/admin.go:245 [Store][database] leader election started (polaris.checker)
2023-07-18T11:12:35.763291Z info    job/job.go:68   [Maintain][Job] job (DeleteUnHealthyInstance) not enable
2023-07-18T11:12:35.763332Z info    job/job.go:68   [Maintain][Job] job (DeleteEmptyAutoCreatedService) not enable
2023-07-18T11:12:35.764587Z info    postgresql/admin.go:350 [Store][database] change from leader to follower (MaintainJob.CleanDeletedInstances)
2023-07-18T11:12:35.764642Z info    postgresql/admin.go:245 [Store][database] leader election started (MaintainJob.CleanDeletedInstances)
2023-07-18T11:12:35.765352Z info    postgresql/admin.go:350 [Store][database] change from leader to follower (MaintainJob.CleanDeletedClients)
2023-07-18T11:12:35.765397Z info    postgresql/admin.go:245 [Store][database] leader election started (MaintainJob.CleanDeletedClients)
2023-07-18T11:12:35.776558Z error   postgresql/service.go:1098  [Store][database] fetch service rows scan err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.776908Z error   postgresql/service.go:864   [Store][database] call fetch service rows err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.776964Z error   postgresql/service.go:755   [Store][database] get more service main err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.777004Z error   postgresql/service.go:405   [Store][database] get more service+meta err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.777790Z info    base/base_worker.go:105 [APICall] base stats need sleep 25s
2023-07-18T11:12:35.781996Z info    base/base_worker.go:105 [APICall] base stats need sleep 25s
2023-07-18T11:12:35.782770Z info    eurekaserver/server.go:254  [EUREKA] custom eureka parameters: map[]
2023-07-18T11:12:35.782830Z info    eurekaserver/server.go:310  start EurekaServer
2023-07-18T11:12:35.785119Z error   postgresql/service.go:1098  [Store][database] fetch service rows scan err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported
2023-07-18T11:12:35.786578Z error   bootstrap/server.go:544 self register err: store layer exception: getService err: sql: Scan error on column index 11, name "ports": converting NULL to string is unsupported

# polaris-naming-error.log
2023-07-18T11:12:35.786290Z error   naming  service/instance.go:147 [Instance] create service if absent fail : code:<value:500001 > info:<value:"store layer exception: getService err: sql: Scan error on column index 11, name \"ports\": converting NULL to string is unsupported" > , req : service:<value:"polaris.checker" > namespace:<value:"Polaris" > host:<value:"127.0.0.1" > port:<value:8091 > protocol:<value:"grpc" > version:<value:"v0.1.0" > enable_health_check:<value:true > health_check:<type:HEARTBEAT heartbeat:<ttl:<value:5 > > > isolate:<> metadata:<key:"build-revision" value:"v0.1.0" > metadata:<key:"polaris_service" value:"polaris.checker" > 
pemako commented 1 year ago

对应的 healthcheck 配置的 checkers.name = heartbeatLeader 可以解决这个问题,使用 heartbeatMemory 时会导致上述的错误

chuntaojun commented 1 year ago

都应的 healthcheck 配置的 checkers.name = heartbeatLeader 可以解决这个问题,使用 heartbeatMemory 时会导致上述的错误

我理解这个确实是一个bug,不管怎么设置都不应该有这个报错

pemako commented 1 year ago

确实是有问题,重新测试了下无论 healthcheck.checkers.name 设置为 heartbeatLeader 还是 heartbeatMemory 都会导致服务启动不了。上面那次启动成功的示例复现不了了。

bingxindan commented 1 year ago

确实是有问题,重新测试了下无论 healthcheck.checkers.name 设置为 heartbeatLeader 还是 heartbeatMemory 都会导致服务启动不了。上面那次启动成功的示例复现不了了。

这是我的bug,已经修复好了,使用最新版的postgresql插件就可以了。谢谢您的反馈!

bingxindan commented 1 year ago

确实是有问题,重新测试了下无论 healthcheck.checkers.name 设置为 heartbeatLeader 还是 heartbeatMemory 都会导致服务启动不了。上面那次启动成功的示例复现不了了。

方便的话,可以加个微信,我快速帮您解决