Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
🥺
conduwuit
Commits
a74613be
Commit
a74613be
authored
7 months ago
by
Jason Volk
Committed by
Jason Volk
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
improve database repair/shutdown log messages
Signed-off-by:
Jason Volk
<
jason@zemos.net
>
parent
a95ded16
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/database/engine.rs
+19
-5
19 additions, 5 deletions
src/database/engine.rs
with
19 additions
and
5 deletions
src/database/engine.rs
+
19
−
5
View file @
a74613be
use
std
::{
use
std
::{
collections
::{
BTreeSet
,
HashMap
},
collections
::{
BTreeSet
,
HashMap
},
fmt
::
Write
,
fmt
::
Write
,
path
::
PathBuf
,
sync
::{
atomic
::
AtomicU32
,
Arc
,
Mutex
,
RwLock
},
sync
::{
atomic
::
AtomicU32
,
Arc
,
Mutex
,
RwLock
},
};
};
use
conduit
::{
debug
,
error
,
info
,
utils
::
time
::
rfc2822_from_seconds
,
warn
,
Result
,
Server
};
use
conduit
::{
debug
,
error
,
info
,
utils
::
time
::
rfc2822_from_seconds
,
warn
,
Err
,
Result
,
Server
};
use
rocksdb
::{
use
rocksdb
::{
backup
::{
BackupEngine
,
BackupEngineOptions
},
backup
::{
BackupEngine
,
BackupEngineOptions
},
perf
::
get_memory_usage_stats
,
perf
::
get_memory_usage_stats
,
...
@@ -50,10 +51,7 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
...
@@ -50,10 +51,7 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
let
load_time
=
std
::
time
::
Instant
::
now
();
let
load_time
=
std
::
time
::
Instant
::
now
();
if
config
.rocksdb_repair
{
if
config
.rocksdb_repair
{
warn!
(
"Starting database repair. This may take a long time..."
);
repair
(
&
db_opts
,
&
config
.database_path
)
?
;
if
let
Err
(
e
)
=
Db
::
repair
(
&
db_opts
,
&
config
.database_path
)
{
error!
(
"Repair failed: {e:?}"
);
}
}
}
debug!
(
"Listing column families in database"
);
debug!
(
"Listing column families in database"
);
...
@@ -77,6 +75,7 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
...
@@ -77,6 +75,7 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
let
db
=
res
.or_else
(
or_else
)
?
;
let
db
=
res
.or_else
(
or_else
)
?
;
info!
(
info!
(
columns
=
cfs
.len
(),
sequence
=
%
db
.latest_sequence_number
(),
sequence
=
%
db
.latest_sequence_number
(),
time
=
?
load_time
.elapsed
(),
time
=
?
load_time
.elapsed
(),
"Opened database."
"Opened database."
...
@@ -243,6 +242,16 @@ pub fn file_list(&self) -> Result<String> {
...
@@ -243,6 +242,16 @@ pub fn file_list(&self) -> Result<String> {
}
}
}
}
pub
(
crate
)
fn
repair
(
db_opts
:
&
Options
,
path
:
&
PathBuf
)
->
Result
<
()
>
{
warn!
(
"Starting database repair. This may take a long time..."
);
match
Db
::
repair
(
db_opts
,
path
)
{
Ok
(())
=>
info!
(
"Database repair successful."
),
Err
(
e
)
=>
return
Err!
(
"Repair failed: {e:?}"
),
}
Ok
(())
}
impl
Drop
for
Engine
{
impl
Drop
for
Engine
{
#[cold]
#[cold]
fn
drop
(
&
mut
self
)
{
fn
drop
(
&
mut
self
)
{
...
@@ -259,5 +268,10 @@ fn drop(&mut self) {
...
@@ -259,5 +268,10 @@ fn drop(&mut self) {
debug!
(
"Joining background threads..."
);
debug!
(
"Joining background threads..."
);
self
.env
.join_all_threads
();
self
.env
.join_all_threads
();
info!
(
sequence
=
%
self
.db
.latest_sequence_number
(),
"Closing database..."
);
}
}
}
}
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