Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
5afb8a5d
Commit
5afb8a5d
authored
Aug 03, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track the last command
parent
efa74341
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
RedisCommand.cs
...kExchange.Redis/StackExchange/Redis/Enums/RedisCommand.cs
+2
-0
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+9
-4
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+2
-1
No files found.
StackExchange.Redis/StackExchange/Redis/Enums/RedisCommand.cs
View file @
5afb8a5d
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
{
{
internal
enum
RedisCommand
internal
enum
RedisCommand
{
{
NONE
,
// must be first for "zero reasons"
APPEND
,
APPEND
,
ASKING
,
ASKING
,
AUTH
,
AUTH
,
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
5afb8a5d
...
@@ -86,6 +86,8 @@ public long SubscriptionCount
...
@@ -86,6 +86,8 @@ public long SubscriptionCount
internal
long
OperationCount
=>
Interlocked
.
Read
(
ref
operationCount
);
internal
long
OperationCount
=>
Interlocked
.
Read
(
ref
operationCount
);
public
RedisCommand
LastCommand
{
get
;
private
set
;
}
public
void
Dispose
()
public
void
Dispose
()
{
{
isDisposed
=
true
;
isDisposed
=
true
;
...
@@ -103,10 +105,12 @@ public void Dispose()
...
@@ -103,10 +105,12 @@ public void Dispose()
// in a finalizer, but we need to kill that socket,
// in a finalizer, but we need to kill that socket,
// and this is the first place that isn't going to
// and this is the first place that isn't going to
// be rooted by the socket async bits
// be rooted by the socket async bits
try
{
try
{
var
tmp
=
physical
;
var
tmp
=
physical
;
tmp
?.
Shutdown
();
tmp
?.
Shutdown
();
}
catch
{
}
}
catch
{
}
}
}
public
void
ReportNextFailure
()
public
void
ReportNextFailure
()
{
{
...
@@ -342,7 +346,7 @@ private void AbandonPendingBacklog(Exception ex)
...
@@ -342,7 +346,7 @@ private void AbandonPendingBacklog(Exception ex)
do
do
{
{
next
=
DequeueNextPendingBacklog
();
next
=
DequeueNextPendingBacklog
();
if
(
next
!=
null
)
if
(
next
!=
null
)
{
{
Multiplexer
?.
OnMessageFaulted
(
next
,
ex
);
Multiplexer
?.
OnMessageFaulted
(
next
,
ex
);
next
.
SetException
(
ex
);
next
.
SetException
(
ex
);
...
@@ -671,12 +675,13 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
...
@@ -671,12 +675,13 @@ private WriteResult WriteMessageToServerInsideWriteLock(PhysicalConnection conne
try
try
{
{
var
cmd
=
message
.
Command
;
var
cmd
=
message
.
Command
;
LastCommand
=
cmd
;
bool
isMasterOnly
=
message
.
IsMasterOnly
();
bool
isMasterOnly
=
message
.
IsMasterOnly
();
if
(
isMasterOnly
&&
ServerEndPoint
.
IsSlave
&&
(
ServerEndPoint
.
SlaveReadOnly
||
!
ServerEndPoint
.
AllowSlaveWrites
))
if
(
isMasterOnly
&&
ServerEndPoint
.
IsSlave
&&
(
ServerEndPoint
.
SlaveReadOnly
||
!
ServerEndPoint
.
AllowSlaveWrites
))
{
{
throw
ExceptionFactory
.
MasterOnly
(
Multiplexer
.
IncludeDetailInExceptions
,
message
.
Command
,
message
,
ServerEndPoint
);
throw
ExceptionFactory
.
MasterOnly
(
Multiplexer
.
IncludeDetailInExceptions
,
message
.
Command
,
message
,
ServerEndPoint
);
}
}
if
(
message
.
Comman
d
==
RedisCommand
.
QUIT
)
connection
.
RecordQuit
();
if
(
cm
d
==
RedisCommand
.
QUIT
)
connection
.
RecordQuit
();
SelectDatabaseInsideWriteLock
(
connection
,
message
);
SelectDatabaseInsideWriteLock
(
connection
,
message
);
if
(!
connection
.
TransactionActive
)
if
(!
connection
.
TransactionActive
)
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
5afb8a5d
...
@@ -325,7 +325,8 @@ public Task FlushAsync()
...
@@ -325,7 +325,8 @@ public Task FlushAsync()
{
{
if
(
bridge
!=
null
)
if
(
bridge
!=
null
)
{
{
exMessage
.
Append
(
" on "
).
Append
(
Format
.
ToString
(
bridge
.
ServerEndPoint
?.
EndPoint
)).
Append
(
"/"
).
Append
(
connectionType
);
exMessage
.
Append
(
" on "
).
Append
(
Format
.
ToString
(
bridge
.
ServerEndPoint
?.
EndPoint
)).
Append
(
"/"
).
Append
(
connectionType
)
.
Append
(
", last: "
).
Append
(
bridge
.
LastCommand
);
data
.
Add
(
Tuple
.
Create
(
"FailureType"
,
failureType
.
ToString
()));
data
.
Add
(
Tuple
.
Create
(
"FailureType"
,
failureType
.
ToString
()));
data
.
Add
(
Tuple
.
Create
(
"EndPoint"
,
Format
.
ToString
(
bridge
.
ServerEndPoint
?.
EndPoint
)));
data
.
Add
(
Tuple
.
Create
(
"EndPoint"
,
Format
.
ToString
(
bridge
.
ServerEndPoint
?.
EndPoint
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment