Skip to content

Fix rice-box not found problem#5711

Merged
morgo merged 2 commits intovitessio:masterfrom
planetscale:morgo-fix-rice-box
Jan 15, 2020
Merged

Fix rice-box not found problem#5711
morgo merged 2 commits intovitessio:masterfrom
planetscale:morgo-fix-rice-box

Conversation

@morgo
Copy link
Copy Markdown
Contributor

@morgo morgo commented Jan 14, 2020

This fixes #5654 after it was discovered that it does not work as intended when the config directory is not present!

Rice boxes do not support being called in an Init function, which means that without refactoring we can currently not use this feature for the init_db.sql file.

Unfortunately this means that the examples need to find a path to init_db.sql. I am not really happy with the solution I went with, but I copied the config/init_db.sql file to examples/local.

The alternative is that we could re-introduce VTROOT as a dependency, or add some sort of symlink in the repo + a copy on making packages. As I said - I'm not happy with the current solution, and really open to ideas.

Thanks @enisoc : it now works as expected.

Edit: This has a second behavior change, which is that the embedded config is no longer rebuilt on make build. This created potentially noisy commits, since it kept bumping the timestamps. It also made the automated build system think it was working on dirty trees.

Signed-off-by: Morgan Tocker tocker@gmail.com

@morgo morgo requested a review from sougou as a code owner January 14, 2020 17:39
@morgo morgo force-pushed the morgo-fix-rice-box branch from 8e3a710 to 2e0073a Compare January 14, 2020 18:26
@morgo morgo requested a review from enisoc January 14, 2020 19:31
Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

I think it is actually a good thing to have the example be more self-contained and less reliant on files spread out in the code base.

@enisoc
Copy link
Copy Markdown
Member

enisoc commented Jan 15, 2020

Rice boxes do not support being called in an Init function, which means that without refactoring we can currently not use this feature for the init_db.sql file.

We wouldn't need to call it from an init() function here. This is just a regular function that happens to be called Init(). It gets called explicitly after main() starts, so it should be fine to call rice.FindBox() from inside Mysqld.Init(). We just can't call rice.FindBox() from a package-level variable initializer as we did previously.

Signed-off-by: Morgan Tocker <tocker@gmail.com>
@morgo morgo force-pushed the morgo-fix-rice-box branch from 2e0073a to e35346d Compare January 15, 2020 01:20
@morgo
Copy link
Copy Markdown
Contributor Author

morgo commented Jan 15, 2020

We wouldn't need to call it from an init() function here. This is just a regular function that happens to be called Init(). It gets called explicitly after main() starts, so it should be fine to call rice.FindBox() from inside Mysqld.Init(). We just can't call rice.FindBox() from a package-level variable initializer as we did previously.

You are right! it is an Init() function, not an init() function. I've updated it, and it seems to work locally. Let's see if CI works.

I think it is actually a good thing to have the example be more self-contained and less reliant on files spread out in the code base.

That's the goal. I just don't didn't like the implementation.

Signed-off-by: Morgan Tocker <tocker@gmail.com>
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