-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, see L152.
PTAL |
LGTM PTAL @hhkbp2 |
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}; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
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") |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make -> may?
LGTM. |
@siddontang PTAL |
LGTM |
* 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]>
ref: #1028
@ngaut @siddontang @disksing @zhangjinpeng1987 PTAL