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
e0acd36f
Commit
e0acd36f
authored
4 years ago
by
Marcin
Browse files
Options
Downloads
Patches
Plain Diff
vacuuming hive_posts only for massive sync
parent
e71379fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!456
Release candidate v1 24
,
!411
vacuuming hive_posts only for massive sync
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hive/db/db_state.py
+17
-18
17 additions, 18 deletions
hive/db/db_state.py
with
17 additions
and
18 deletions
hive/db/db_state.py
+
17
−
18
View file @
e0acd36f
...
...
@@ -250,6 +250,13 @@ class DbState:
force_index_rebuild
=
True
massive_sync_preconditions
=
True
def
vacuum_hive_posts
():
if
massive_sync_preconditions
:
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE hive_posts
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE hive_posts executed in %.4fs
"
,
time_end
-
time_start
)
#is_pre_process, drop, create
cls
.
processing_indexes
(
False
,
force_index_rebuild
,
True
)
...
...
@@ -276,10 +283,7 @@ class DbState:
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] update_hive_posts_children_count executed in %.4fs
"
,
time_end
-
time_start
)
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE hive_posts
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE hive_posts executed in %.4fs
"
,
time_end
-
time_start
)
vacuum_hive_posts
()
time_start
=
perf_counter
()
# Update root_id all root posts
...
...
@@ -290,10 +294,7 @@ class DbState:
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] update_hive_posts_root_id executed in %.4fs
"
,
time_end
-
time_start
)
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE hive_posts
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE hive_posts executed in %.4fs
"
,
time_end
-
time_start
)
vacuum_hive_posts
()
time_start
=
perf_counter
()
...
...
@@ -313,14 +314,10 @@ class DbState:
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] update_all_posts_active executed in %.4fs
"
,
time_end
-
time_start
)
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE hive_posts
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE hive_posts executed in %.4fs
"
,
time_end
-
time_start
)
vacuum_hive_posts
()
time_start
=
perf_counter
()
sql
=
"""
SELECT update_feed_cache({}, {});
"""
.
format
(
last_imported_block
,
current_imported_block
)
...
...
@@ -362,7 +359,8 @@ class DbState:
DbState
.
db
().
query_no_return
(
sql
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] update_posts_rshares executed in %.4fs
"
,
time_end
-
time_start
)
# add here 'vacuum analyze hive_posts' when You want to add below more actions which update hive_posts table
vacuum_hive_posts
()
time_start
=
perf_counter
()
sql
=
"""
...
...
@@ -393,10 +391,11 @@ class DbState:
log
.
info
(
"
Recreating FKs
"
)
create_fk
(
cls
.
db
())
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE executed in %.4fs
"
,
time_end
-
time_start
)
time_start
=
perf_counter
()
DbState
.
db
().
query_no_return
(
"
VACUUM ANALYZE
"
)
time_end
=
perf_counter
()
log
.
info
(
"
[INIT] VACUUM ANALYZE executed in %.4fs
"
,
time_end
-
time_start
)
@staticmethod
...
...
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