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
4cd87860
Commit
4cd87860
authored
Aug 09, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
even moar TransactionLog usefulness
parent
85165681
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
TestBase.cs
StackExchange.Redis.Tests/TestBase.cs
+1
-1
RedisTransaction.cs
StackExchange.Redis/StackExchange/Redis/RedisTransaction.cs
+9
-2
No files found.
StackExchange.Redis.Tests/TestBase.cs
View file @
4cd87860
...
...
@@ -261,7 +261,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer)
muxer
.
ConnectionFailed
+=
OnConnectionFailed
;
muxer
.
MessageFaulted
+=
(
msg
,
ex
,
origin
)
=>
Writer
?.
WriteLine
(
$"Faulted from '
{
origin
}
': '
{
msg
}
' - '
{(
ex
==
null
?
"(null)"
:
ex
.
Message
)}
'"
);
muxer
.
Connecting
+=
(
e
,
t
)
=>
Writer
.
WriteLine
(
$"Connecting to
{
Format
.
ToString
(
e
)}
as
{
t
}
"
);
muxer
.
TransactionLog
+=
msg
=>
Writer
.
WriteLine
(
"tran: "
+
msg
)
;
muxer
.
TransactionLog
+=
msg
=>
{
lock
(
Writer
)
{
Writer
.
WriteLine
(
"tran: "
+
msg
);
}
}
;
muxer
.
Resurrecting
+=
(
e
,
t
)
=>
Writer
.
WriteLine
(
$"Resurrecting
{
Format
.
ToString
(
e
)}
as
{
t
}
"
);
muxer
.
Closing
+=
complete
=>
Writer
.
WriteLine
(
complete
?
"Closed"
:
"Closing..."
);
return
muxer
;
...
...
StackExchange.Redis/StackExchange/Redis/RedisTransaction.cs
View file @
4cd87860
...
...
@@ -162,6 +162,9 @@ protected override void WriteImpl(PhysicalConnection physical)
Wrapped
.
SetRequestSent
();
}
public
override
int
ArgCount
=>
Wrapped
.
ArgCount
;
public
override
string
CommandAndKey
=>
Wrapped
.
CommandAndKey
;
public
override
int
GetHashSlot
(
ServerSelectionStrategy
serverSelectionStrategy
)
=>
Wrapped
.
GetHashSlot
(
serverSelectionStrategy
);
}
private
class
QueuedProcessor
:
ResultProcessor
<
bool
>
...
...
@@ -174,6 +177,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
{
if
(
message
is
QueuedMessage
q
)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"observed QUEUED for "
+
q
.
Wrapped
?.
CommandAndKey
);
q
.
WasQueued
=
true
;
}
return
true
;
...
...
@@ -318,7 +322,6 @@ public IEnumerable<Message> GetMessages(PhysicalConnection connection)
}
multiplexer
.
OnTransactionLog
(
$"issued
{
InnerOperations
.
Length
}
operations"
);
if
(
explicitCheckForQueued
&&
lastBox
!=
null
)
{
multiplexer
.
OnTransactionLog
(
$"checking conditions in the *late* path"
);
...
...
@@ -373,7 +376,7 @@ public IEnumerable<Message> GetMessages(PhysicalConnection connection)
}
}
connection
.
Trace
(
"End of transaction: "
+
Command
);
multiplexer
.
OnTransactionLog
(
$"issuing
{
this
.
Command
}
"
);
multiplexer
.
OnTransactionLog
(
$"issuing
{
Command
}
"
);
yield
return
this
;
// acts as either an EXEC or an UNWATCH, depending on "aborted"
}
...
...
@@ -424,6 +427,7 @@ public override bool SetResult(PhysicalConnection connection, Message message, R
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"got
{
result
}
for
{
message
.
CommandAndKey
}
"
);
if
(
message
is
TransactionMessage
tran
)
{
var
bridge
=
connection
.
BridgeCouldBeNull
;
...
...
@@ -457,6 +461,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
var
arr
=
result
.
GetItems
();
if
(
result
.
IsNull
)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"aborting wrapped messages (failed watch)"
);
connection
.
Trace
(
"Server aborted due to failed WATCH"
);
foreach
(
var
op
in
wrapped
)
{
...
...
@@ -469,8 +474,10 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
else
if
(
wrapped
.
Length
==
arr
.
Length
)
{
connection
.
Trace
(
"Server committed; processing nested replies"
);
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"processing
{
arr
.
Length
}
wrapped messages"
);
for
(
int
i
=
0
;
i
<
arr
.
Length
;
i
++)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"> got
{
arr
[
i
]}
for
{
wrapped
[
i
].
Wrapped
.
CommandAndKey
}
"
);
if
(
wrapped
[
i
].
Wrapped
.
ComputeResult
(
connection
,
arr
[
i
]))
{
bridge
.
CompleteSyncOrAsync
(
wrapped
[
i
].
Wrapped
);
...
...
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