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

idx_migration tool #425

Merged
merged 9 commits into from
Dec 23, 2016
Merged

idx_migration tool #425

merged 9 commits into from
Dec 23, 2016

Conversation

woodsaj
Copy link
Member

@woodsaj woodsaj commented Dec 16, 2016

No description provided.

@woodsaj
Copy link
Member Author

woodsaj commented Dec 16, 2016

@Dieterbe I think we need to cleanup the partitioning in tsdb-gw before we merge this tool.

I have opened https://github.com/raintank/tsdb-gw/issues/16 to address this.

@Dieterbe
Copy link
Contributor

I want to have a consistent naming scheme for tools that works well with tab completion . maybe something like:

mt-index-migrate
mt-index-dump
mt-blah

define a generic partitioner interface for getting the partition id
of a metricData or metricDefinition struct.  Impliment initial
KafkaPartitioner that can partition based on orgId or series name.
@woodsaj woodsaj changed the title WIP: idx_migration tool idx_migration tool Dec 23, 2016
@Dieterbe
Copy link
Contributor

Now use 4b buf for byorg. May be incompat with previous approach I think but not a problem since all current deployments just consume all partitions. On phone excuse brevity

return k.Partitioner.Partition(&sarama.ProducerMessage{Key: sarama.ByteEncoder(key)}, numPartitions)
}

func (k *KafkaPartitioner) GetPartitionKey(m schema.PartitionedMetric, b []byte) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Callable by other packages needed ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it is called by tsdb-gw

"gopkg.in/raintank/schema.v1"
)

const table_schema = `CREATE TABLE IF NOT EXISTS %s.metric_idx (
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems safer to reuse the table and index schema defined in idx package

p, err := partitioner.Partition(&mdef, int32(*numPartitions))
if err != nil {
log.Error(3, "failed to get partition id of metric. %s", err)
mdef.Partition = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition seems like a big problem warranting an abort instead of proceeding with 0 partition

re-use cassandraIdx keyspace consts in mt-index-migrate
@woodsaj
Copy link
Member Author

woodsaj commented Dec 23, 2016

we only need 4bytes for the orgId. hashing a 8byte slice padded with 0's is a waste of CPU cycles.

Changing the partitioning in existing deployments wont have any impact as we are not running sharded clusters anywhere.

@woodsaj woodsaj merged commit df36251 into master Dec 23, 2016
@woodsaj woodsaj deleted the idxMigration branch December 23, 2016 09:06
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.

2 participants