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

transport: discard droppable msg when channel full #1054

Merged
merged 10 commits into from
Sep 18, 2016
Merged

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented Sep 9, 2016

@siddontang
Copy link
Contributor

why not using send + try_send?


pub fn try_send(&self, mut t: T, mut try_times: usize) -> Result<(), Error> {
loop {
t = match self.ch.send(t) {
Copy link
Member

Choose a reason for hiding this comment

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

Any tests to cover the two branches?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, see L152.

@BusyJay
Copy link
Member Author

BusyJay commented Sep 13, 2016

PTAL

@siddontang
Copy link
Contributor

LGTM

PTAL @hhkbp2

@BusyJay BusyJay changed the title [DNM] transport: discard droppable msg when channel full transport: discard droppable msg when channel full Sep 18, 2016
@BusyJay
Copy link
Member Author

BusyJay commented Sep 18, 2016

PTAL

@@ -41,7 +41,7 @@ use storage::mvcc::{MvccTxn, MvccReader, Error as MvccError};
use storage::{Key, Value, KvPair};
use std::collections::HashMap;
use mio::{self, EventLoop};
use util::transport::SendCh;
use util::transport::{SendCh, MAX_SEND_RETRY_CNT};
Copy link
Contributor

@hhkbp2 hhkbp2 Sep 18, 2016

Choose a reason for hiding this comment

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

MAX_SEND_RETRY_CNT is a global constant and used everywhere when calling try_send(). Maybe it's good to make retry count an attribute of this channel, and ignore it when calling try_send().


/// Try send t with default try times.
pub fn try_send(&self, t: T) -> Result<(), Error> {
self.send_with_try_times(t, MAX_SEND_RETRY_CNT)
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer send using retry count but try_send using only 1, like channel send and try_send.

@hhkbp2
Copy link
Contributor

hhkbp2 commented Sep 18, 2016

LGTM

@@ -23,7 +23,11 @@ const MAX_SEND_RETRY_CNT: usize = 5;
quick_error! {
#[derive(Debug)]
pub enum Error {
Other(err: Box<error::Error + Sync + Send>) {
Discard(reason: String) {
description("message is discard")
Copy link
Contributor

Choose a reason for hiding this comment

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

message is discarded

impl<T: Debug> From<NotifyError<T>> for Error {
fn from(e: NotifyError<T>) -> Error {
match e {
// ALLERT!! make cause sensitive data leak.
Copy link
Contributor

Choose a reason for hiding this comment

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

make -> may?

@disksing
Copy link
Contributor

LGTM.

@BusyJay
Copy link
Member Author

BusyJay commented Sep 18, 2016

@siddontang PTAL

@siddontang
Copy link
Contributor

LGTM

@BusyJay BusyJay merged commit 489f7c1 into master Sep 18, 2016
@BusyJay BusyJay deleted the busyjay/discard-msg branch September 18, 2016 13:00
mittalrishabh pushed a commit to mittalrishabh/tikv that referenced this pull request Nov 22, 2024
* fix the issue that stale timestamp may be a future one

Signed-off-by: you06 <[email protected]>

* add regression test

Signed-off-by: you06 <[email protected]>

* lazy init lastTSO

Signed-off-by: you06 <[email protected]>

* fix panic

Signed-off-by: you06 <[email protected]>

* address comment

Signed-off-by: you06 <[email protected]>

---------

Signed-off-by: you06 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants