Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
2341ac57
Commit
2341ac57
authored
4 years ago
by
Mariusz Trela
Browse files
Options
Downloads
Patches
Plain Diff
A block number is retrieved from `hive_state` table during post-synchronization
parent
7399e388
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!456
Release candidate v1 24
,
!230
Setup monitoring with pghero
,
!144
Restoring indexes is always done
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/db/db_state.py
+5
-7
5 additions, 7 deletions
hive/db/db_state.py
hive/indexer/sync.py
+1
-1
1 addition, 1 deletion
hive/indexer/sync.py
with
6 additions
and
8 deletions
hive/db/db_state.py
+
5
−
7
View file @
2341ac57
...
...
@@ -66,10 +66,10 @@ class DbState:
return
cls
.
_db
@classmethod
def
finish_initial_sync
(
cls
,
current_imported_block
,
last_imported_block
):
def
finish_initial_sync
(
cls
,
current_imported_block
):
"""
Set status to initial sync complete.
"""
assert
cls
.
_is_initial_sync
,
"
initial sync was not started.
"
cls
.
_after_initial_sync
(
current_imported_block
,
last_imported_block
)
cls
.
_after_initial_sync
(
current_imported_block
)
cls
.
_is_initial_sync
=
False
log
.
info
(
"
[INIT] Initial sync complete!
"
)
...
...
@@ -139,10 +139,6 @@ class DbState:
@classmethod
def
processing_indexes
(
cls
,
is_pre_process
,
drop
,
create
):
# sql = "SELECT promoted FROM hive_posts WHERE id = :id"
# curr_amount = DB.query_one(sql, id=record['post_id'])
# new_amount = curr_amount + record['amount']
DB
=
cls
.
db
()
engine
=
DB
.
engine
()
log
.
info
(
"
[INIT] Begin %s-initial sync hooks
"
,
"
pre
"
if
is_pre_process
else
"
post
"
)
...
...
@@ -202,12 +198,14 @@ class DbState:
return
current_work_mem
@classmethod
def
_after_initial_sync
(
cls
,
current_imported_block
,
last_imported_block
):
def
_after_initial_sync
(
cls
,
current_imported_block
):
"""
Routine which runs *once* after initial sync.
Re-creates non-core indexes for serving APIs after init sync,
as well as all foreign keys.
"""
last_imported_block
=
DbState
.
db
().
query_one
(
"
SELECT block_num FROM hive_state LIMIT 1
"
)
assert
current_imported_block
>=
last_imported_block
synced_blocks
=
current_imported_block
-
last_imported_block
...
...
This diff is collapsed.
Click to expand it.
hive/indexer/sync.py
+
1
−
1
View file @
2341ac57
...
...
@@ -251,7 +251,7 @@ class Sync:
if
not
CONTINUE_PROCESSING
:
return
current_imported_block
=
Blocks
.
head_num
()
DbState
.
finish_initial_sync
(
current_imported_block
,
last_imported_block
)
DbState
.
finish_initial_sync
(
current_imported_block
)
else
:
# recover from fork
Blocks
.
verify_head
(
self
.
_steem
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment