Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
19d7a37a
Unverified
Commit
19d7a37a
authored
Mar 01, 2021
by
gary rong
Committed by
GitHub
Mar 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/rawdb: fix the transaction indexer (#22395)
parent
d9687042
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
chain_iterator.go
core/rawdb/chain_iterator.go
+14
-14
No files found.
core/rawdb/chain_iterator.go
View file @
19d7a37a
...
...
@@ -243,14 +243,14 @@ func indexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan
}
}
}
// If there exists uncommitted data, flush them.
if
batch
.
ValueSize
()
>
0
{
WriteTxIndexTail
(
batch
,
lastNum
)
// Also write the tail there
// Flush the new indexing tail and the last committed data. It can also happen
// that the last batch is empty because nothing to index, but the tail has to
// be flushed anyway.
WriteTxIndexTail
(
batch
,
lastNum
)
if
err
:=
batch
.
Write
();
err
!=
nil
{
log
.
Crit
(
"Failed writing batch to db"
,
"error"
,
err
)
return
}
}
select
{
case
<-
interrupt
:
log
.
Debug
(
"Transaction indexing interrupted"
,
"blocks"
,
blocks
,
"txs"
,
txs
,
"tail"
,
lastNum
,
"elapsed"
,
common
.
PrettyDuration
(
time
.
Since
(
start
)))
...
...
@@ -334,14 +334,14 @@ func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt ch
}
}
}
// Commit the last batch if there exists uncommitted data
if
batch
.
ValueSize
()
>
0
{
// Flush the new indexing tail and the last committed data. It can also happen
// that the last batch is empty because nothing to unindex, but the tail has to
// be flushed anyway.
WriteTxIndexTail
(
batch
,
nextNum
)
if
err
:=
batch
.
Write
();
err
!=
nil
{
log
.
Crit
(
"Failed writing batch to db"
,
"error"
,
err
)
return
}
}
select
{
case
<-
interrupt
:
log
.
Debug
(
"Transaction unindexing interrupted"
,
"blocks"
,
blocks
,
"txs"
,
txs
,
"tail"
,
to
,
"elapsed"
,
common
.
PrettyDuration
(
time
.
Since
(
start
)))
...
...
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