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