Skip to content

Make the schemas declarative, add a new schema for better load balancing.#262

Merged
tomwilkie merged 2 commits intomasterfrom
254-label-in-hash-key
Feb 6, 2017
Merged

Make the schemas declarative, add a new schema for better load balancing.#262
tomwilkie merged 2 commits intomasterfrom
254-label-in-hash-key

Conversation

@tomwilkie
Copy link
Copy Markdown
Contributor

@tomwilkie tomwilkie commented Feb 2, 2017

Part of #254

  • Define a Schema interface for calculating the hash and range keys to use.
  • Make implementations of this interface for all the different schema's we've had.
  • Make a "CompositeSchema" which delegates to various schema's depending on when they we activated.
  • Update chunk store to use this; in particular, invert the order of the merge and intersect in the query path.
  • Bunch of testing

TODO:

@tomwilkie tomwilkie self-assigned this Feb 2, 2017
@tomwilkie tomwilkie force-pushed the 254-label-in-hash-key branch 2 times, most recently from a1b68bd to 97dc83d Compare February 2, 2017 20:58
@tomwilkie tomwilkie force-pushed the 254-label-in-hash-key branch 2 times, most recently from e304e0e to ef4929c Compare February 3, 2017 16:11
Copy link
Copy Markdown
Contributor

@jml jml left a comment

Choose a reason for hiding this comment

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

Just a quick look at chunk/schema.go for now. More to follow later.

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd rename this to GetWriteBuckets because it doesn't actually write buckets.

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same, GetRead...

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worth mentioning how / why this might fail?

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/this/these/

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we're going this far, why not type RangeKey = []byte (if that is the right thing)

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lolgo

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The callback thing seems a bit weird. I can see how it leads to briefer code below, but surely defining a struct and returning a slice / sending to a channel is more traditional.

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This deserves a doc comment saying what it's for.

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't have a constructive alternative (yet), but these panics point to the interface not being quite right.

@tomwilkie tomwilkie changed the title [WIP] Make the schemas declarative. Make the schemas declarative, add a new schema for better load balancing. Feb 5, 2017
chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

componsite -> composite
deletegates -> delegates

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't it the lowest, not the highest, here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes it is. I think code is correct; will update comment.

chunk/schema.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the found schema is the 0th, can this not become -1 and then the code below crashes (c.schemas[i])?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True; in reality I didn't think this would happen (as we stick a schema in at 0), but I guess someone could send a sample from before 1970 and crash us...

@juliusv
Copy link
Copy Markdown
Contributor

juliusv commented Feb 6, 2017

Looks pretty good to me besides minor comments!

- Define a Schema interface for calculating the hash and range keys to use.
- Make implementations of this interface for all the different schema's we've had.
- Make a "CompositeSchema" which delegates to various schema's depending on when they we activated.
- Update chunk store to use this; in particular, invert the order of the merge and intersect in the query path.
- Add v4 schema, which puts the label key in the hash key for better load distribution
- Remove query related-metrics, they're not used.

Bunch of testing:
- Test the hash key generators, range key generators and composite scheme
- Run the chunk store tests against each schema.
- Resolve issue found from extending the tests - don't check results match label name, thats implied.
- DynamoDB won't accept empty keys; they should just be omitted.
- Deal with case where two schemas start at the same time.
@tomwilkie tomwilkie force-pushed the 254-label-in-hash-key branch from fae601f to ee0abb5 Compare February 6, 2017 14:42
@juliusv
Copy link
Copy Markdown
Contributor

juliusv commented Feb 6, 2017

👍

@tomwilkie tomwilkie merged commit f66f505 into master Feb 6, 2017
@tomwilkie tomwilkie deleted the 254-label-in-hash-key branch February 6, 2017 15:13
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.

3 participants