Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
7e467623
Commit
7e467623
authored
Nov 27, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix maybeGC trigger condition
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
20b06a4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
core/corerepo/gc.go
core/corerepo/gc.go
+13
-8
No files found.
core/corerepo/gc.go
View file @
7e467623
...
...
@@ -174,15 +174,13 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
return
err
}
if
storage
+
offset
>
gc
.
StorageMax
{
err
:=
ErrMaxStorageExceeded
log
.
Error
(
err
)
return
err
}
if
storage
+
offset
>
gc
.
StorageGC
{
if
storage
+
offset
>
gc
.
StorageMax
{
log
.
Warningf
(
"pre-GC: %s"
,
ErrMaxStorageExceeded
)
}
// Do GC here
log
.
Info
(
"Starting repo GC..."
)
log
.
Info
(
"
Watermark exceeded.
Starting repo GC..."
)
defer
log
.
EventBegin
(
ctx
,
"repoGC"
)
.
Done
()
// 1 minute is sufficient for ~1GB unlink() blocks each of 100kb in SSD
_ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Duration
(
gc
.
SlackGB
)
*
time
.
Minute
)
...
...
@@ -196,7 +194,14 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
return
err
}
log
.
Infof
(
"Repo GC done. Released %s
\n
"
,
humanize
.
Bytes
(
uint64
(
storage
-
newStorage
)))
return
nil
if
newStorage
>
gc
.
StorageGC
{
log
.
Warningf
(
"post-GC: Watermark still exceeded"
)
if
newStorage
>
gc
.
StorageMax
{
err
:=
ErrMaxStorageExceeded
log
.
Error
(
err
)
return
err
}
}
}
return
nil
}
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