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

Add Support for saving CompressionOptions to Options File #6817

Closed
wants to merge 2 commits into from

Conversation

mrambacher
Copy link
Contributor

This PR does a few things:

  • The "compression_opts" and "bottom_compression_opts" can now be read/written as name/value pairs of options (instead of only a colon-separated list;
  • These options can now be read/written to the Options file;
  • The parallel_threads value can now be set (either in the colon or name-value format).

The compression options are now stored and treated as a OptionTypeInfo::Struct by the options system, meaning they can be read and written like the other structs. This change allows them to be read/written easily to the options file.

Additionally, the colon-format was extended to allow support for setting parallel threads. Tests were added to test all of the option settings via the optional parameters in the colon format.

@zhichao-cao
Copy link
Contributor

@mrambacher Thanks for the fix. We will hold it until 6424, 6425 are merged.

@zhichao-cao
Copy link
Contributor

Thanks for working on the CompressionOption part the dealing with the special case! Looks good to me. Just some minor comments.

@zhichao-cao
Copy link
Contributor

@siying You may take a look at this PR if it is as you expected.

Copy link
Contributor

@siying siying left a comment

Choose a reason for hiding this comment

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

It looks good to me. Maybe @ajkr has some comments. But I would defer to @zhichao-cao to approve.

@zhichao-cao
Copy link
Contributor

It looks good to me. Maybe @ajkr has some comments. But I would defer to @zhichao-cao to approve.

Thanks for reviewing it. @ajkr you may take a look before I approve it?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

compression_opts.enabled =
ParseBoolean("", value.substr(start, value.size() - start));
}
}

// enabled is optional for backwards compatibility
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should document somewhere that enabled is actually required if the user tries to provide parallel_threads. It seems a bit difficult to figure out right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should document somewhere that enabled is actually required if the user tries to provide parallel_threads. It seems a bit difficult to figure out right now.

You mean, explain it in the HISTORY.md?

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

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

Looked around and didn't see anywhere good to document colon-separated option strings. So this LGTM.


ASSERT_OK(GetColumnFamilyOptionsFromString(
config_options, ColumnFamilyOptions(),
"compression_opts=4:5:6:7:8:9:true; "
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether "compression_opts=4:5:6:7:8:9:2" works, as that seems the most likely mistake (trying to specify 2 for parallel_threads but actually setting enabled).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That actually would not work, since "2" is not a valid boolean. That case would throw an exception and return an error.

As it is written, if you want to specify parallel_threads, you must also specify enabled. The reason for this is that enabled was added in an earlier release.

This change allows the CompressionOptions to be read/written to the options file. The CompressionOptions can be read as a ":" separated list or as a name=value structure. Additionally, because the option is a struct, indvidual elements (compression_opts.window_bits) can also be read/written.

The parallel threads option is also now supported in the ":" format.

Tests were added that the optional arguments in the ":" format are parsed successfully.
@facebook-github-bot
Copy link
Contributor

@mrambacher has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@zhichao-cao zhichao-cao left a comment

Choose a reason for hiding this comment

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

LGTM.

@facebook-github-bot
Copy link
Contributor

@zhichao-cao merged this pull request in ec711b2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants