File tree 3 files changed +27
-5
lines changed 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 4
4
"io"
5
5
6
6
"github.com/prometheus/client_golang/prometheus"
7
+ "github.com/prometheus/common/log"
7
8
"github.com/prometheus/common/model"
8
9
"github.com/prometheus/prometheus/storage/local/chunk"
9
10
@@ -52,7 +53,10 @@ func (i *Ingester) TransferChunks(stream client.Ingester_TransferChunksServer) e
52
53
// We can't send "extra" fields with a streaming call, so we repeat
53
54
// wireSeries.FromIngesterId and assume it is the same every time
54
55
// round this loop.
55
- fromIngesterID = wireSeries .FromIngesterId
56
+ if fromIngesterID == "" {
57
+ fromIngesterID = wireSeries .FromIngesterId
58
+ log .Infof ("Processing TransferChunks request from ingester '%s'." )
59
+ }
56
60
metric := util .FromLabelPairs (wireSeries .Labels )
57
61
userCtx := user .Inject (stream .Context (), wireSeries .UserId )
58
62
descs , err := fromWireChunks (wireSeries .Chunks )
Original file line number Diff line number Diff line change @@ -325,13 +325,20 @@ func (i *Ingester) processShutdown() {
325
325
flushRequired = false
326
326
}
327
327
}
328
+
328
329
if flushRequired {
329
330
i .flushAllChunks ()
330
- }
331
331
332
- // Close the flush queues, to unblock waiting workers.
333
- for _ , flushQueue := range i .flushQueues {
334
- flushQueue .Close ()
332
+ // Close the flush queues, to unblock waiting workers.
333
+ for _ , flushQueue := range i .flushQueues {
334
+ flushQueue .Close ()
335
+ }
336
+ } else {
337
+
338
+ // Close & empty all the flush queues, to unblock waiting workers.
339
+ for _ , flushQueue := range i .flushQueues {
340
+ flushQueue .DrainAndClose ()
341
+ }
335
342
}
336
343
337
344
// Wait for chunks to be flushed.
@@ -389,6 +396,7 @@ func (i *Ingester) transferChunks() error {
389
396
return err
390
397
}
391
398
399
+ log .Infof ("Successfully sent chunks to '%s'" , targetIngester .Addr )
392
400
return nil
393
401
}
394
402
Original file line number Diff line number Diff line change @@ -66,6 +66,16 @@ func (pq *PriorityQueue) Close() {
66
66
pq .cond .Broadcast ()
67
67
}
68
68
69
+ // DrainAndClose closed the queue and removes all the items from it.
70
+ func (pq * PriorityQueue ) DrainAndClose () {
71
+ pq .lock .Lock ()
72
+ defer pq .lock .Unlock ()
73
+ pq .closed = true
74
+ pq .queue = nil
75
+ pq .hit = map [string ]struct {}{}
76
+ pq .cond .Broadcast ()
77
+ }
78
+
69
79
// Enqueue adds an operation to the queue in priority order. If the operation
70
80
// is already on the queue, it will be ignored.
71
81
func (pq * PriorityQueue ) Enqueue (op Op ) {
You can’t perform that action at this time.
0 commit comments