nebula-java icon indicating copy to clipboard operation
nebula-java copied to clipboard

The storage leader address for the partition of metaManager cache does not look correct

Open iiibui opened this issue 4 years ago • 3 comments

对应代码:https://github.com/vesoft-inc/nebula-java/blob/3518faa8444c1f590fba92d7f7c66946ad696852/client/src/main/java/com/vesoft/nebula/client/meta/MetaManager.java#L114

GetPartsAllocReq返回的分区信息无法确定哪个host是leader吧?代码取了第一个,对比 ListHosts 返回的 LeaderParts,第一个并不是 Leader Host。我是参考这里的 https://github.com/vesoft-inc/nebula-common/blob/master/src/common/clients/meta/MetaClient.cpp#L3189

另外 StorageClient 目前只有 scanXXX 接口,有无计划补全剩下的接口?

iiibui avatar Sep 22 '21 05:09 iiibui

对应代码:

https://github.com/vesoft-inc/nebula-java/blob/3518faa8444c1f590fba92d7f7c66946ad696852/client/src/main/java/com/vesoft/nebula/client/meta/MetaManager.java#L114

GetPartsAllocReq返回的分区信息无法确定哪个host是leader吧?代码取了第一个,对比 ListHosts 返回的 LeaderParts,第一个并不是 Leader Host。我是参考这里的 https://github.com/vesoft-inc/nebula-common/blob/master/src/common/clients/meta/MetaClient.cpp#L3189

另外 StorageClient 目前只有 scanXXX 接口,有无计划补全剩下的接口?

  1. GetPartsAlloc just returns the hosts of part, we cann't know which one is the leaser host. The leader host is generated by caller's retry. If the host is not leader, then the response will has LEADER_CHANGE error code, and the true leader will be contained in response. Refer https://github.com/vesoft-inc/nebula-java/blob/3518faa8444c1f590fba92d7f7c66946ad696852/client/src/main/java/com/vesoft/nebula/client/storage/scan/ScanVertexResultIterator.java#L177
  2. For now, we don't have plan to support more operation interfaces. Thanks for your attention.

Nicole00 avatar Sep 26 '21 06:09 Nicole00

Oh, I see. Why not use ListHosts to get the right storage leaser host of part in initialization like cpp client to reduce one possible failed request? Because of compatibility?

iiibui avatar Sep 28 '21 02:09 iiibui

Oh, I see. Why not use ListHosts to get the right storage leaser host of part in initialization like cpp client to reduce one possible failed request? Because of compatibility?

Yeah, it's a meaning point. When develop the scan process, we use the habitual positive thinking to get part's hosts. And you're right, using listHosts will be more effective.

Nicole00 avatar Dec 29 '22 07:12 Nicole00