Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
585513b4
Commit
585513b4
authored
Jul 17, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
YA corner case: help assumption by putting cancelled transactions first.
parent
21413347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
ccan/tdb/tools/replay_trace.c
ccan/tdb/tools/replay_trace.c
+21
-2
No files found.
ccan/tdb/tools/replay_trace.c
View file @
585513b4
...
...
@@ -962,6 +962,12 @@ static bool in_transaction(const struct op op[], unsigned int i)
return
op
[
i
].
group_start
&&
starts_transaction
(
&
op
[
op
[
i
].
group_start
]);
}
static
bool
successful_transaction
(
const
struct
op
*
op
)
{
return
starts_transaction
(
op
)
&&
op
[
op
->
group_len
].
op
==
OP_TDB_TRANSACTION_COMMIT
;
}
static
bool
starts_traverse
(
const
struct
op
*
op
)
{
return
op
->
op
==
OP_TDB_TRAVERSE_START
...
...
@@ -1265,8 +1271,21 @@ static void sort_ops(struct keyinfo hash[], char *filename[], struct op *op[],
return
a
->
op_num
-
b
->
op_num
;
/* Otherwise, arrange by serial order. */
return
op
[
a
->
file
][
a
->
op_num
].
serial
-
op
[
b
->
file
][
b
->
op_num
].
serial
;
if
(
op
[
a
->
file
][
a
->
op_num
].
serial
!=
op
[
b
->
file
][
b
->
op_num
].
serial
)
return
op
[
a
->
file
][
a
->
op_num
].
serial
-
op
[
b
->
file
][
b
->
op_num
].
serial
;
/* Cancelled transactions are assumed to happen first. */
if
(
starts_transaction
(
&
op
[
a
->
file
][
a
->
op_num
])
&&
!
successful_transaction
(
&
op
[
a
->
file
][
a
->
op_num
]))
return
-
1
;
if
(
starts_transaction
(
&
op
[
b
->
file
][
b
->
op_num
])
&&
!
successful_transaction
(
&
op
[
b
->
file
][
b
->
op_num
]))
return
1
;
/* No idea. */
return
0
;
}
/* Now sort into serial order. */
...
...
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