createWALBlock creates a new appendable block
(meta *backend.BlockMeta, filepath, dataEncoding string, ingestionSlack time.Duration)
| 156 | |
| 157 | // createWALBlock creates a new appendable block |
| 158 | func 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 | |
| 195 | func ownsWALBlock(entry fs.DirEntry) bool { |
| 196 | // all vParquet wal blocks are folders |