Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goshimmer
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
iota-imt
goshimmer
Commits
70cfe4ee
Unverified
Commit
70cfe4ee
authored
4 years ago
by
Acha Bill
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
adds a cli to override database dirty flag (#629)
* adds a cli to override database dirty flag * gofmt
parent
bbd89929
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/database/parameters.go
+3
-0
3 additions, 0 deletions
plugins/database/parameters.go
plugins/database/plugin.go
+12
-0
12 additions, 0 deletions
plugins/database/plugin.go
with
15 additions
and
0 deletions
plugins/database/parameters.go
+
3
−
0
View file @
70cfe4ee
...
...
@@ -9,9 +9,12 @@ const (
CfgDatabaseDir
=
"database.directory"
// CfgDatabaseInMemory defines whether to use an in-memory database.
CfgDatabaseInMemory
=
"database.inMemory"
// CfgDatabaseDirty defines whether to override the database dirty flag.
CfgDatabaseDirty
=
"database.dirty"
)
func
init
()
{
flag
.
String
(
CfgDatabaseDir
,
"mainnetdb"
,
"path to the database folder"
)
flag
.
Bool
(
CfgDatabaseInMemory
,
false
,
"whether the database is only kept in memory and not persisted"
)
flag
.
String
(
CfgDatabaseDirty
,
""
,
"set the dirty flag of the database"
)
}
This diff is collapsed.
Click to expand it.
plugins/database/plugin.go
+
12
−
0
View file @
70cfe4ee
...
...
@@ -3,6 +3,7 @@ package database
import
(
"errors"
"strconv"
"sync"
"time"
...
...
@@ -77,6 +78,17 @@ func configure(_ *node.Plugin) {
log
.
Fatalf
(
"Failed to check database version: %s"
,
err
)
}
if
str
:=
config
.
Node
()
.
GetString
(
CfgDatabaseDirty
);
str
!=
""
{
val
,
err
:=
strconv
.
ParseBool
(
str
)
if
err
!=
nil
{
log
.
Warnf
(
"Invalid %s: %s"
,
CfgDatabaseDirty
,
err
)
}
else
if
val
{
MarkDatabaseUnhealthy
()
}
else
{
MarkDatabaseHealthy
()
}
}
if
IsDatabaseUnhealthy
()
{
log
.
Fatal
(
"The database is marked as not properly shutdown/corrupted, please delete the database folder and restart."
)
}
...
...
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