Skip to content

Commit

Permalink
Logs deletion fixes (#3827)
Browse files Browse the repository at this point in the history
* fix temp file suffix in delete requests table

* log error on failure in removal of temp file only when the error is not os.IsNotExist

* fix the cli flag for delete requests cancellation period
  • Loading branch information
sandeepsukhani authored Jun 9, 2021
1 parent 0d27c21 commit cd38e98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/stores/shipper/compactor/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
f.DurationVar(&cfg.RetentionDeleteDelay, "boltdb.shipper.compactor.retention-delete-delay", 2*time.Hour, "Delay after which chunks will be fully deleted during retention.")
f.BoolVar(&cfg.RetentionEnabled, "boltdb.shipper.compactor.retention-enabled", false, "(Experimental) Activate custom (per-stream,per-tenant) retention.")
f.IntVar(&cfg.RetentionDeleteWorkCount, "boltdb.shipper.compactor.retention-delete-worker-count", 150, "The total amount of worker to use to delete chunks.")
f.DurationVar(&cfg.DeleteRequestCancelPeriod, "purger.delete-request-cancel-period", 24*time.Hour, "Allow cancellation of delete request until duration after they are created. Data would be deleted only after delete requests have been older than this duration. Ideally this should be set to at least 24h.")
f.DurationVar(&cfg.DeleteRequestCancelPeriod, "boltdb.shipper.compactor.delete-request-cancel-period", 24*time.Hour, "Allow cancellation of delete request until duration after they are created. Data would be deleted only after delete requests have been older than this duration. Ideally this should be set to at least 24h.")
}

func (cfg *Config) IsDefaults() bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func newDeleteRequestsTable(workingDirectory string, objectClient chunk.ObjectCl
}

func (t *deleteRequestsTable) init() error {
tempFilePath := fmt.Sprintf("%s.%s", t.dbPath, tempFileSuffix)
tempFilePath := fmt.Sprintf("%s%s", t.dbPath, tempFileSuffix)

if err := os.Remove(tempFilePath); err != nil {
if err := os.Remove(tempFilePath); err != nil && !os.IsNotExist(err) {
level.Error(util_log.Logger).Log("msg", fmt.Sprintf("failed to remove temp file %s", tempFilePath), "err", err)
}

Expand Down

0 comments on commit cd38e98

Please sign in to comment.