mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
phase168: count admitted native WAL requests
This commit is contained in:
1 parent
95c14c22f1
commit
e360536dc6
4 files changed
+20
-4
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
type NativeIOStats struct {
|
||||
Enabled bool
|
||||
QueueDepth uint32
|
||||
AdmittedRequests uint64
|
||||
SubmissionRounds uint64
|
||||
SQEs uint64
|
||||
SubmitSyscalls uint64
|
||||
@@ -99,6 +100,12 @@ func (submitter *nativeWALSubmitter) recordQueueFull() {
|
||||
submitter.mu.Unlock()
|
||||
}
|
||||
|
||||
func (submitter *nativeWALSubmitter) recordAdmitted(count int) {
|
||||
submitter.mu.Lock()
|
||||
submitter.stats.AdmittedRequests += uint64(count)
|
||||
submitter.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *Store) NativeIOStats() NativeIOStats {
|
||||
if s.native == nil {
|
||||
return NativeIOStats{}
|
||||
|
||||
@@ -30,14 +30,16 @@ func TestIOUringOwnerBatchesAcrossLanesAndRecoversPortably(t *testing.T) {
|
||||
t.Fatalf("LSNs=%v want=[1 2 3 4]", lsns)
|
||||
}
|
||||
stats := store.NativeIOStats()
|
||||
if !stats.Enabled || stats.SubmissionRounds != 1 || stats.SQEs != 4 ||
|
||||
if !stats.Enabled || stats.AdmittedRequests != 4 ||
|
||||
stats.SubmissionRounds != 1 || stats.SQEs != 4 ||
|
||||
stats.CompletionCount != 4 || stats.InflightHighWater != 4 ||
|
||||
stats.FallbackCount != 0 {
|
||||
t.Fatalf("native stats=%+v", stats)
|
||||
}
|
||||
t.Logf(
|
||||
"native_owner_stats enabled=%t rounds=%d sqes=%d completions=%d inflight_high_water=%d fallback=%d",
|
||||
"native_owner_stats enabled=%t admitted=%d rounds=%d sqes=%d completions=%d inflight_high_water=%d fallback=%d",
|
||||
stats.Enabled,
|
||||
stats.AdmittedRequests,
|
||||
stats.SubmissionRounds,
|
||||
stats.SQEs,
|
||||
stats.CompletionCount,
|
||||
@@ -91,7 +93,7 @@ func TestIOUringOwnerRotatesAcrossLanesAtDepthOne(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
stats := store.NativeIOStats()
|
||||
if stats.QueueDepth != 1 || stats.SubmissionRounds != 4 ||
|
||||
if stats.QueueDepth != 1 || stats.AdmittedRequests != 4 || stats.SubmissionRounds != 4 ||
|
||||
stats.SQEs != 4 || stats.CompletionCount != 4 {
|
||||
t.Fatalf("depth-one native stats=%+v", stats)
|
||||
}
|
||||
|
||||
@@ -620,6 +620,9 @@ func (s *Store) submit(lba uint32, data []byte, sourceLSN uint64) (uint64, error
|
||||
s.nextLSN = lsn + 1
|
||||
s.pending[lsn] = req
|
||||
s.inflightAppends++
|
||||
if s.native != nil {
|
||||
s.native.recordAdmitted(1)
|
||||
}
|
||||
startDrainer := s.queueRequest(l, req)
|
||||
s.mu.Unlock()
|
||||
if startDrainer {
|
||||
@@ -718,6 +721,9 @@ func (s *Store) WriteBatch(startLBA uint32, blocks [][]byte) ([]uint64, error) {
|
||||
}
|
||||
s.nextLSN += uint64(len(reqs))
|
||||
s.inflightAppends += len(reqs)
|
||||
if s.native != nil {
|
||||
s.native.recordAdmitted(len(reqs))
|
||||
}
|
||||
startDrainers := make([]bool, len(s.lanes))
|
||||
for _, req := range reqs {
|
||||
if s.queueRequest(s.lanes[req.lane], req) {
|
||||
|
||||
@@ -38,8 +38,9 @@ timeout 60s go test ./core/storage/parallelwal \
|
||||
-count=1 -v >"${OWNER_LOG}" 2>&1
|
||||
require_line '^--- PASS: TestIOUringOwnerBatchesAcrossLanesAndRecoversPortably ' "${OWNER_LOG}"
|
||||
require_line '^--- PASS: TestPositionedExecutionRemainsDefault ' "${OWNER_LOG}"
|
||||
require_line 'native_owner_stats enabled=true rounds=1 sqes=4 completions=4 inflight_high_water=4 fallback=0' "${OWNER_LOG}"
|
||||
require_line 'native_owner_stats enabled=true admitted=4 rounds=1 sqes=4 completions=4 inflight_high_water=4 fallback=0' "${OWNER_LOG}"
|
||||
write_summary "single_owner_cross_lane_round=pass"
|
||||
write_summary "admitted_requests=4"
|
||||
write_summary "submission_rounds=1"
|
||||
write_summary "sqes=4"
|
||||
write_summary "completions=4"
|
||||
|
||||
Reference in new issue
Block a user