-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BACKPORT 2.15.0] [#13176] DocDB: Generate gFlags metadata xml at bui…
…ld time Summary: Generate the gFlags xml metadata file for yb-master and yb-tserver at build time and include them in the release package. gFlags are defined with a hard coded value in one file which then get linked to multiple applications. The only way for one of the application to have a custom default value is to update the flag at runtime at process startup before calling google::ParseCommandLineNonHelpFlags. Ex: yb-master sets evict_failed_followers to false. New flag dump_flags_xml will dump the flag description in xml format with the current runtime value of the flags displayed as default. This is called at build time for both yb-master and yb-tserver and the output xml files are made part of the tar package. Fixes #13176 Original commit: 2a7ffce / D18153 Test Plan: ./yb_build.sh on m1 Mac and gcp Dev Server All Detective builds Reviewers: rahuldesirazu, mbautin, slingam Reviewed By: slingam Subscribers: bogdan, ybase Differential Revision: https://phabricator.dev.yugabyte.com/D18211
- Loading branch information
Showing
7 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) YugaByte, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
set -euo pipefail | ||
. "${BASH_SOURCE%/*}/common-build-env.sh" | ||
|
||
activate_virtualenv | ||
set_pythonpath | ||
"$YB_SRC_ROOT"/python/yb/gen_flags_metadata.py "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright (c) YugaByte, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
""" | ||
A wrapper to generate gFlags metadata for yb-master and yb-tserver. | ||
""" | ||
|
||
import sys | ||
import os | ||
import logging | ||
import time | ||
|
||
from yugabyte_pycommon import init_logging, run_program, WorkDirContext # type: ignore | ||
|
||
|
||
def main(): | ||
if len(sys.argv) != 3: | ||
print("Usage: {} <program_name> <output_file_path>".format(sys.argv[0])) | ||
sys.exit(1) | ||
start_time_sec = time.time() | ||
build_root = os.environ['YB_BUILD_ROOT'] | ||
program_name = sys.argv[1] | ||
flags_metadata_file = sys.argv[2] | ||
|
||
with WorkDirContext(build_root): | ||
content = run_program( | ||
[ | ||
os.path.join(build_root, 'bin', program_name), | ||
"--dump_flags_xml", | ||
], | ||
shell=True | ||
) | ||
|
||
with open(flags_metadata_file, 'w+', encoding='utf-8') as f: | ||
f.write(content.stdout) | ||
|
||
elapsed_time_sec = time.time() - start_time_sec | ||
logging.info("Generated flags_metadata for %s in %.1f sec", program_name, elapsed_time_sec) | ||
|
||
|
||
if __name__ == '__main__': | ||
init_logging() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters