Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move region peer_cache to the peer cache itself #1859

Merged
merged 4 commits into from
May 25, 2017

Conversation

lishuai87
Copy link
Contributor

Fixes #1843.

@siddontang
Copy link
Contributor

Any benchmark?

@zhangjinpeng87
Copy link
Member

LGTM

@siddontang
Copy link
Contributor

I suggest moving peer_cache to another PR.

@lishuai87
Copy link
Contributor Author

lishuai87 commented May 24, 2017

OK, I will submit a new PR.

@lishuai87 lishuai87 closed this May 24, 2017
@lishuai87 lishuai87 changed the title replace hashmap with flat_map for peer_cache and raft.prs move region peer_cache to the peer cache itself May 24, 2017
@lishuai87
Copy link
Contributor Author

lishuai87 commented May 24, 2017

please merge PR #1861 first. "replace hashmap raft.prs with flatmap"

@lishuai87 lishuai87 reopened this May 24, 2017
@ngaut
Copy link
Member

ngaut commented May 24, 2017

Please rebase master.

@lishuai87 lishuai87 force-pushed the javaforfun/replace-hashmap-peer-cache branch from 7c2e543 to a21be4d Compare May 24, 2017 11:46
Copy link
Contributor

@siddontang siddontang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siddontang
Copy link
Contributor

PTAL @BusyJay

@@ -192,14 +192,14 @@ pub struct PeerStat {
pub struct Peer {
engine: Arc<DB>,
cfg: Rc<Config>,
peer_cache: Rc<RefCell<HashMap<u64, metapb::Peer>>>,
peer_cache: RefCell<FlatMap<u64, metapb::Peer>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not going to be shared, then RefCell is unnecessary.

Copy link
Contributor Author

@lishuai87 lishuai87 May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use RefCell for interior mutability, as get_peer_from_cache may insert new elem. e.g. store.validate_region

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be borrowed mutably.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove RefCell, @BusyJay ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But may not in this pr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javaforfun please update it later.

@BusyJay
Copy link
Member

BusyJay commented May 25, 2017

LGTM

@siddontang siddontang merged commit 4df90a3 into master May 25, 2017
@siddontang siddontang deleted the javaforfun/replace-hashmap-peer-cache branch May 25, 2017 13:09
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
iosmanthus pushed a commit to iosmanthus/tikv that referenced this pull request Oct 17, 2024
…ikv#1859)

* add low priority scheduler

Signed-off-by: Ping Yu <yuping@pingcap.cn>

* make low priority pool optional

Signed-off-by: Ping Yu <yuping@pingcap.cn>

---------

Signed-off-by: Ping Yu <yuping@pingcap.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider using vector instead of hashmap in raft Peer
6 participants