77 "sync"
88
99 "github.com/10gen/migration-verifier/internal/logger"
10+ "github.com/10gen/migration-verifier/internal/reportutils"
1011)
1112
1213type Unit = int64
@@ -91,6 +92,12 @@ func (mt *Tracker) track(ctx context.Context) {
9192 got := (gotVal .Interface ()).(Unit )
9293 mt .cur += got
9394
95+ if got < 0 {
96+ mt .logger .Debug ().
97+ Str ("reclaimed" , reportutils .FmtBytes (- got )).
98+ Msg ("Reclaimed tracked memory." )
99+ }
100+
94101 if alive {
95102 if got == 0 {
96103 mt .logger .Panic ().Msg ("Got zero track value but channel is not closed." )
@@ -116,8 +123,8 @@ func (mt *Tracker) track(ctx context.Context) {
116123
117124 if ! didSingleThread {
118125 mt .logger .Warn ().
119- Int64 ("usage" , mt .cur ).
120- Int64 ("softLimit" , mt .max ).
126+ Str ("usage" , reportutils . FmtBytes ( mt .cur ) ).
127+ Str ("softLimit" , reportutils . FmtBytes ( mt .max ) ).
121128 Msg ("Tracked memory usage now exceeds soft limit. Suspending concurrent reads until tracked usage falls." )
122129
123130 didSingleThread = true
@@ -133,8 +140,8 @@ func (mt *Tracker) track(ctx context.Context) {
133140
134141 if didSingleThread {
135142 mt .logger .Info ().
136- Int64 ("usage" , mt .cur ).
137- Int64 ("softLimit" , mt .max ).
143+ Str ("usage" , reportutils . FmtBytes ( mt .cur ) ).
144+ Str ("softLimit" , reportutils . FmtBytes ( mt .max ) ).
138145 Msg ("Tracked memory usage is now below soft limit. Resuming concurrent reads." )
139146 }
140147 }
0 commit comments