Ádám Bakai has posted comments on this change. ( http://gerrit.cloudera.org:8080/19585 )
Change subject: KUDU-3437 Set default block_cache_metrics_policy to reset ...................................................................... Patch Set 3: (1 comment) http://gerrit.cloudera.org:8080/#/c/19585/3//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/19585/3//COMMIT_MSG@9 PS3, Line 9: empty local directories > Why a new master joins the cluster, it will execute Master::Init() twice? It works in the following order: master_runner.cc:RunMasterServer is executed. It runs this part of the code: unique_ptr<Master> server(new Master(opts)); RETURN_NOT_OK(server->Init()); RETURN_NOT_OK(server->Start()); After that, since FLAGS_master_auto_join_cluster is true, it enters the loop, since needs_add is true, it adds itself, then this part is executed: // If we succeeded, wipe the system catalog on this node and initiate a // copy from another node. RETURN_NOT_OK(ClearLocalSystemCatalogAndCopy(leader_hp)); server.reset(new Master(opts)); RETURN_NOT_OK(server->Init()); RETURN_NOT_OK(server->Start()); You are correct, it happens because BlockCache is a singleton, so when this is executed: cfile::BlockCache::GetSingleton()->StartInstrumentation( metric_entity(), opts_.block_cache_metrics_policy()); It will be executed on the same BlockCache. It will run: ShardedCache::SetMetrics where there is this check: CHECK(IsGTest()) << "Metrics should only be set once per Cache"; Which allows multiple metrics set in tests. My problem was that the code tried to do multiple metrics set when running master server(so no test environment) and ran into check failed. -- To view, visit http://gerrit.cloudera.org:8080/19585 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Idc32d7ab02201382debcbe36311579550353bf71 Gerrit-Change-Number: 19585 Gerrit-PatchSet: 3 Gerrit-Owner: Ádám Bakai <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Attila Bukor <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Wang Xixu <[email protected]> Gerrit-Reviewer: Yuqi Du <[email protected]> Gerrit-Reviewer: Zoltan Chovan <[email protected]> Gerrit-Reviewer: Ádám Bakai <[email protected]> Gerrit-Comment-Date: Thu, 16 Mar 2023 11:28:27 +0000 Gerrit-HasComments: Yes
