mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 07:19:17 +01:00
lib/logstorage: postpone initialization of per-shard stateSizeBudget until the first call to pipeProcessor.writeBlock()
This simplifies pipeProcessor initialization logic a bit. This also doesn't mangle the original maxStateSize value, which is used in error messages when the state size exceeds maxStateSize.
This commit is contained in:
parent
a18d4f79d4
commit
b5d94f06f5
@ -116,11 +116,9 @@ func newPipeSortProcessor(ps *pipeSort, workersCount int, stopCh <-chan struct{}
|
|||||||
for i := range shards {
|
for i := range shards {
|
||||||
shards[i] = pipeSortProcessorShard{
|
shards[i] = pipeSortProcessorShard{
|
||||||
pipeSortProcessorShardNopad: pipeSortProcessorShardNopad{
|
pipeSortProcessorShardNopad: pipeSortProcessorShardNopad{
|
||||||
ps: ps,
|
ps: ps,
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
psp := &pipeSortProcessor{
|
psp := &pipeSortProcessor{
|
||||||
|
@ -20,11 +20,9 @@ func newPipeTopkProcessor(ps *pipeSort, workersCount int, stopCh <-chan struct{}
|
|||||||
for i := range shards {
|
for i := range shards {
|
||||||
shards[i] = pipeTopkProcessorShard{
|
shards[i] = pipeTopkProcessorShard{
|
||||||
pipeTopkProcessorShardNopad: pipeTopkProcessorShardNopad{
|
pipeTopkProcessorShardNopad: pipeTopkProcessorShardNopad{
|
||||||
ps: ps,
|
ps: ps,
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptp := &pipeTopkProcessor{
|
ptp := &pipeTopkProcessor{
|
||||||
|
@ -162,11 +162,8 @@ func (ps *pipeStats) newPipeProcessor(workersCount int, stopCh <-chan struct{},
|
|||||||
shards[i] = pipeStatsProcessorShard{
|
shards[i] = pipeStatsProcessorShard{
|
||||||
pipeStatsProcessorShardNopad: pipeStatsProcessorShardNopad{
|
pipeStatsProcessorShardNopad: pipeStatsProcessorShardNopad{
|
||||||
ps: ps,
|
ps: ps,
|
||||||
|
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
psp := &pipeStatsProcessor{
|
psp := &pipeStatsProcessor{
|
||||||
|
@ -74,11 +74,9 @@ func (pc *pipeStreamContext) newPipeProcessor(workersCount int, stopCh <-chan st
|
|||||||
for i := range shards {
|
for i := range shards {
|
||||||
shards[i] = pipeStreamContextProcessorShard{
|
shards[i] = pipeStreamContextProcessorShard{
|
||||||
pipeStreamContextProcessorShardNopad: pipeStreamContextProcessorShardNopad{
|
pipeStreamContextProcessorShardNopad: pipeStreamContextProcessorShardNopad{
|
||||||
pc: pc,
|
pc: pc,
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pcp := &pipeStreamContextProcessor{
|
pcp := &pipeStreamContextProcessor{
|
||||||
|
@ -79,11 +79,9 @@ func (pt *pipeTop) newPipeProcessor(workersCount int, stopCh <-chan struct{}, ca
|
|||||||
for i := range shards {
|
for i := range shards {
|
||||||
shards[i] = pipeTopProcessorShard{
|
shards[i] = pipeTopProcessorShard{
|
||||||
pipeTopProcessorShardNopad: pipeTopProcessorShardNopad{
|
pipeTopProcessorShardNopad: pipeTopProcessorShardNopad{
|
||||||
pt: pt,
|
pt: pt,
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptp := &pipeTopProcessor{
|
ptp := &pipeTopProcessor{
|
||||||
|
@ -74,11 +74,9 @@ func (pu *pipeUniq) newPipeProcessor(workersCount int, stopCh <-chan struct{}, c
|
|||||||
for i := range shards {
|
for i := range shards {
|
||||||
shards[i] = pipeUniqProcessorShard{
|
shards[i] = pipeUniqProcessorShard{
|
||||||
pipeUniqProcessorShardNopad: pipeUniqProcessorShardNopad{
|
pipeUniqProcessorShardNopad: pipeUniqProcessorShardNopad{
|
||||||
pu: pu,
|
pu: pu,
|
||||||
stateSizeBudget: stateSizeBudgetChunk,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
maxStateSize -= stateSizeBudgetChunk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pup := &pipeUniqProcessor{
|
pup := &pipeUniqProcessor{
|
||||||
|
Loading…
Reference in New Issue
Block a user