-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
sort.Slice(sizes, func(i, j int) bool { | ||
a, b := &sizes[i], &sizes[j] | ||
if a.IsImporting != b.IsImporting { | ||
return a.IsImporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean? Do you want to sort all importing engine before other engines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We can't import engines that are already importing, but their size do count towards the disk quota.
3f12d8c
to
f6f87fc
Compare
The test case depends on #505 in order to quickly generate huge SSTs without checking in a 1 GB database or introduce dbgen. |
f6f87fc
to
dad23f5
Compare
3636dc5
to
626f480
Compare
7f8a286
to
f274838
Compare
f274838
to
66a250c
Compare
}) | ||
return | ||
} | ||
|
||
type LocalWriter struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @Little-Wallace, the LocalWriter is basically entirely rewritten, there may be some performance implication of the original code that I may have missed. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
return | ||
} | ||
func() { | ||
rc.diskQuotaLock.RLock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the current implementation can not handle this if the previous check isImporting is false and the disk-quote loop holds the lock and do importing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test
|
||
// append more KV pairs to the kvMemCache. | ||
func (m *kvMemCache) append(kvs []common.KvPair) { | ||
if !m.notSorted { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the kvMemCache has been sorted, we shall still check the order of kvs
. The array kvs
may be unordered and the first key of kvs
may be greater than the lastkey of m.kvs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the loop inside does check the order of kvs
.
var lastKey []byte
if len(m.kvs) > 0 {
lastKey = m.kvs[len(m.kvs)-1].Key
}
for _, kv := range kvs {
if bytes.Compare(kv.Key, lastKey) <= 0 { // <----
m.notSorted = true
break
}
lastKey = kv.Key // <----
}
/lgtm |
/lgtm |
/merge |
/run-all-tests |
@kennytm merge failed. |
/run-all-tests |
What problem does this PR solve?
Implement #446.
What is changed and how it works?
Check List
Tests
Side effects
Related changes