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

Function createWALBlock

tempodb/encoding/vparquet5/wal_block.go:158–193  ·  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

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

Callers 6

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 5

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