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

importer schema conversion fix: don't use overly coarse resolution data just because it has a long retention #1601

Merged
merged 2 commits into from
Jan 27, 2020

Conversation

replay
Copy link
Contributor

@replay replay commented Jan 13, 2020

fixes: #1596

@replay replay changed the title [WIP] Fix schema conversions Fix schema conversions Jan 14, 2020
@fitzoh
Copy link
Contributor

fitzoh commented Jan 16, 2020

Would something like this make sense?

func (c *converter) findSmallestLargestArchive(spp, nop uint32) (int, int) {
	smallestArchiveIdx := -1
	largestArchiveIdx := -1
	threshold := nop * spp
	for i, arch := range c.archives {
		// find largest archive that still has a higher or equal resolution than requested
		if arch.SecondsPerPoint <= spp {
			smallestArchiveIdx = i
		}
		// find smallest archive that still contains enough data to satisfy requested range,
		if arch.SecondsPerPoint > threshold {
			break
		}
		largestArchiveIdx = i
	}

	return smallestArchiveIdx, largestArchiveIdx
}

fitzoh added a commit that referenced this pull request Jan 16, 2020
replay added a commit that referenced this pull request Jan 16, 2020
@replay
Copy link
Contributor Author

replay commented Jan 17, 2020

thx @fitzoh that looks good.
at some point we should also fix this schema conversion so that it solves this issue as well, but i guess that could be done in a new PR: #1609

@Dieterbe Dieterbe force-pushed the fix_schema_conversions branch from 728c1dd to f032327 Compare January 27, 2020 10:46
@Dieterbe Dieterbe changed the title Fix schema conversions importer schema conversion fix: don't use overly coarse resolution data just because it has a long retention Jan 27, 2020
@Dieterbe
Copy link
Contributor

I rewrote the history because it was a mess, and came up with a clearer title.

@Dieterbe Dieterbe merged commit f0601d4 into master Jan 27, 2020
@Dieterbe Dieterbe deleted the fix_schema_conversions branch January 27, 2020 10:52
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.

Schema conversion on import is broken for certain combinations
3 participants