Skip to content

Allow switching to daily instead of hourly index buckets #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2017

Conversation

juliusv
Copy link
Contributor

@juliusv juliusv commented Jan 3, 2017

There can be slight overlap around the switchover time, but I deemed it
safer (and not incorrect) than risking gaps due to some calculation
error.

Part of #10

There can be slight overlap around the switchover time, but I deemed it
safer (and not incorrect) than risking gaps due to some calculation
error.
@juliusv
Copy link
Contributor Author

juliusv commented Jan 3, 2017

@tomwilkie This would be the idea - haven't tested it fully on Kubernetes yet, only the unit test, but will do when I get it all running again.

@@ -332,25 +338,45 @@ func (c *AWSStore) CreateTables() error {
return err
}

func bigBuckets(from, through model.Time) []int64 {
func bigBuckets(from, through model.Time, dailyBucketsFrom model.Time) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd make this a method on AWSStore and not pass dailyBucketsFrom as a param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

if i > lastHourlyBucket {
break
}
result = append(result, strconv.Itoa(int(i)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure the conversion to int is safe here - they'll run out on 2038-01-19 IIRC. Should probably use https://golang.org/pkg/strconv/#FormatInt

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ignore me, these are hours, so the range is huge.

@tomwilkie
Copy link
Contributor

tomwilkie commented Jan 4, 2017

Hmm, looks like leap second handling in unix time isn't what I thought it would be (surprise!): https://en.wikipedia.org/wiki/Unix_time#Leap_seconds. Unix time is noncontiguous. Given that we receive the samples with a unix-like ms timestamp from the client, not sure there is much we can do here.

@tomwilkie
Copy link
Contributor

I'm pretty happy with this, so going to merge. I'm touching the same code as you, so this will save a bad merge.

@tomwilkie tomwilkie merged commit ef27943 into master Jan 4, 2017
@tomwilkie tomwilkie deleted the daily-buckets branch January 4, 2017 10:51
@@ -206,6 +208,10 @@ type AWSStore struct {
tableName string
bucketName string

// Around which time to start bucketing indexes by day instead of by hour.
// Only the day matters, not the time within the day.
dailyBucketsFrom model.Time
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable is never initialised! Which means we'll default to weekly buckets for everything...

We should do two things: copy the config straight into the AWSStore struct, and change the meaning so the time-zero-value means no weekly buckets.

Will backout this PR.

@juliusv
Copy link
Contributor Author

juliusv commented Jan 4, 2017

Sorry about that - thus the remark that I hadn't tried it out yet ;) Hope it didn't cause too much havok (only auto-rolled-out to dev after merging, I assume).

@tomwilkie
Copy link
Contributor

Yeah no worries, as much my bad for not catching / testing it myself before merging.

alanprot pushed a commit that referenced this pull request Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants