Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Conversation

krasi-georgiev
Copy link
Contributor

@krasi-georgiev krasi-georgiev commented Feb 14, 2018

this change ensures that the db can be opened even when one or more folders are missing the meta.js file.
These are skipped when opening the db and deleted when db.reload is called.

@krasi-georgiev krasi-georgiev changed the title [WIP] don't bail for missing meta.js files don't bail for missing meta.js files Feb 14, 2018
@krasi-georgiev
Copy link
Contributor Author

@fabxc is this what you had i mind?

@krasi-georgiev
Copy link
Contributor Author

🎬 @fabxc , @gouthamve just need a quick look and will do the tests.
Also not sure if deleting folders with missing meta.js at retention time is ok?

@@ -313,13 +314,15 @@ func (c *LeveledCompactor) Compact(dest string, dirs ...string) (uid ulid.ULID,
for _, d := range dirs {
b, err := OpenBlock(d, c.chunkPool)
if err != nil {
return uid, err
level.Error(c.logger).Log("msg", "couldn't open a block", "dir", d, "err", err.Error())
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check how deletion of blocks after compaction is handled? For example, if the caller just removes all input dirs if we return with no error, that would be kinda bad.

Copy link
Contributor Author

@krasi-georgiev krasi-georgiev Feb 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I mentioned in the PR description that wasn't sure what should we do here.
Is a folder without a meta file unusable so just delete with some warning log?
I haven't looked at the code for the retention yet, I guess should do the same there, delete with some warning?

@krasi-georgiev krasi-georgiev force-pushed the meta-file-no-crash-when-missing branch 2 times, most recently from 2bf06bf to 353cd6e Compare February 24, 2018 12:15
@krasi-georgiev krasi-georgiev force-pushed the meta-file-no-crash-when-missing branch 3 times, most recently from 92061c8 to 2c0d5d8 Compare February 26, 2018 15:04
@krasi-georgiev
Copy link
Contributor Author

@fabxc PTAL

@krasi-georgiev
Copy link
Contributor Author

ping @gouthamve

@gouthamve
Copy link
Collaborator

Hmm this looks good to me but I'd be very cautious about adding this. Like a missing meta.js file means corrupted data-dir.

With this, we'll get missing data-ranges and a lot of user-queries as to why the storage is dropping data. I still think error-ing out makes sense rather than deleting data. We could add a command to tsdbtool/promtool that does this cleanup.

@krasi-georgiev If this is being accepted, could you add a metric for the number of blocks deleted due to corruption?

@krasi-georgiev
Copy link
Contributor Author

I think @fabxc mentioned that this was the behaviour at some point without any bad consequences.

@gouthamve if we decide to go this road will add the metrics to the same PR.

@krasi-georgiev
Copy link
Contributor Author

closing in favour of #320 best to have this as a separate interface and be run explicitly in case of a data corruption.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants