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