MCPcopy
hub / github.com/grafana/tempo / createWALBlock

Function createWALBlock

tempodb/encoding/vparquet4/wal_block.go:157–191  ·  view source on GitHub ↗

createWALBlock creates a new appendable block

(meta *backend.BlockMeta, filepath, dataEncoding string, ingestionSlack time.Duration)

Source from the content-addressed store, hash-verified

155
156// createWALBlock creates a new appendable block
157func createWALBlock(meta *backend.BlockMeta, filepath, dataEncoding string, ingestionSlack time.Duration) (*walBlock, error) {
158 newMeta := &backend.BlockMeta{
159 Version: VersionString,
160 BlockID: meta.BlockID,
161 TenantID: meta.TenantID,
162 ReplicationFactor: meta.ReplicationFactor,
163 // remove ignored attributes from dedicated columns
164 DedicatedColumns: filterDedicatedColumns(meta.DedicatedColumns),
165 }
166
167 b := &walBlock{
168 meta: newMeta,
169 path: filepath,
170 ids: common.NewIDMap[int64](0),
171 ingestionSlack: ingestionSlack,
172 dedcolsRes: dedicatedColumnsToColumnMapping(newMeta.DedicatedColumns, backend.DedicatedColumnScopeResource),
173 dedcolsSpan: dedicatedColumnsToColumnMapping(newMeta.DedicatedColumns, backend.DedicatedColumnScopeSpan),
174 }
175
176 // build folder
177 err := os.MkdirAll(b.walPath(), 0o700)
178 if err != nil {
179 return nil, err
180 }
181
182 dec, err := model.NewObjectDecoder(dataEncoding)
183 if err != nil {
184 return nil, err
185 }
186 b.decoder = dec
187
188 err = b.openWriter()
189
190 return b, err
191}
192
193func ownsWALBlock(entry fs.DirEntry) bool {
194 // all vParquet wal blocks are folders

Callers 8

CreateWALBlockMethod · 0.70
TestPartialReplayFunction · 0.70
TestWalBlockMetaSnapshotFunction · 0.70
TestWalBlockTombstoneFunction · 0.70
testWalBlockFunction · 0.70

Calls 5

walPathMethod · 0.95
openWriterMethod · 0.95
NewObjectDecoderFunction · 0.92
filterDedicatedColumnsFunction · 0.70

Tested by 7

TestPartialReplayFunction · 0.56
TestWalBlockMetaSnapshotFunction · 0.56
TestWalBlockTombstoneFunction · 0.56
testWalBlockFunction · 0.56