MCPcopy
hub / github.com/uber/aresdb / DeleteColumn

Method DeleteColumn

diskstore/local_diskstore.go:396–423  ·  view source on GitHub ↗

DeleteColumn : Deletes all batches of the specified column.

(table string, columnID int, shard int)

Source from the content-addressed store, hash-verified

394
395// DeleteColumn : Deletes all batches of the specified column.
396func (l LocalDiskStore) DeleteColumn(table string, columnID int, shard int) error {
397 tableArchiveBatchRootDir := GetPathForTableArchiveBatchRootDir(l.rootPath, table, shard)
398 tableArchiveBatchDirs, err := ioutil.ReadDir(tableArchiveBatchRootDir)
399
400 if err != nil {
401 if os.IsNotExist(err) {
402 return nil
403 }
404 return utils.StackError(err, "Failed to list archive batches from table archive batch root dir: %s",
405 tableArchiveBatchRootDir)
406 }
407 for _, f := range tableArchiveBatchDirs {
408 if f.IsDir() {
409 if batchID, batchVersion, seqNum, err := ParseBatchIDAndVersionName(f.Name()); err == nil {
410 vectorPartyFilePath := GetPathForTableArchiveBatchColumnFile(l.rootPath, table, shard, batchID,
411 batchVersion, seqNum, columnID)
412 if err = os.Remove(vectorPartyFilePath); err != nil && !os.IsNotExist(err) {
413 utils.GetLogger().With(
414 "vectorPartyFilePath", vectorPartyFilePath,
415 "err", err,
416 ).Warn("Failed to delete a vector party file")
417 continue
418 }
419 }
420 }
421 }
422 return nil
423}
424
425func daysSinceEpochToTime(daysSinceEpoch int) time.Time {
426 secondsSinceEpoch := int64(daysSinceEpoch) * 86400

Callers

nothing calls this directly

Calls 11

StackErrorFunction · 0.92
GetLoggerFunction · 0.92
IsDirMethod · 0.80
ReadDirMethod · 0.65
NameMethod · 0.65
RemoveMethod · 0.65
WarnMethod · 0.65
WithMethod · 0.65

Tested by

no test coverage detected