Skip to content
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

746 migration #809

Closed
wants to merge 7 commits into from
Closed

746 migration #809

wants to merge 7 commits into from

Conversation

pauldix
Copy link
Member

@pauldix pauldix commented Aug 8, 2014

note quite done. Still have to add the flagging that a shard has been migrated so it won't be done again.

I'm also considering making data migrator only run if they start up influx with an argument to do it. That way, people could upgrade, start things up and then create shard spaces before migrating data. Thoughts?

@damm
Copy link

damm commented Aug 8, 2014

A command line argument sounds great.

log.Error("Error Migrating: ", err)
return
}
// go through in reverse order so most recently created shards will be migrated first
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the directories are sorted using lexicographic order, but we should use numeric sorting according to the comment above. Also, the sort order isn't specified in the documentation. I'm suggesting to explicitly sort the entries.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case, lexigraphical and numerical are the same since the directory names are zero padded. However, I didn't know that the sort order wasn't guaranteed in ReadDir, I just assumed based on what I was getting back.

At the end of the day, it's not super important which get migrated first. The shard id order isn't even a guarantee on which shards have newer data (for instance if they backfill after writing a bunch of current stuff). Ok if I leave as is for now?

- Removed all the deprecated stuff from datastore/shard
- Add data_migrator and test
- Update server to create and run the migrator
- Add the old level_db_shard.go to read old data
* Moved over the data migrator
* Moved over the old leveldbshard code and updated datastore/shard so old code could reference everything.
Will write a file into the shard directory. If a migration is called again, it will skip any shard that has a migration marker in the directory.
return
}
atomic.StoreUint32(&self.migrationRunning, uint32(1))
defer atomic.StoreUint32(&self.migrationRunning, uint32(0))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should either use compare and swap or a lock but not both, unless I'm missing something

Use CompareAndSwap instead, it's cleaner.
Forces order of shard migrations.
Also remove old commented code.
@pauldix pauldix closed this in 5403baf Aug 15, 2014
@toddboom toddboom deleted the 746-migration branch May 5, 2015 19:44
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