-
Notifications
You must be signed in to change notification settings - Fork 328
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
HAWQ-1373 - Added feature to reload GUC values using hawq reload-config #1254
Changes from 3 commits
ce25db4
bf79fab
f46c736
48da94d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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. | ||
*/ | ||
|
||
#include <string> | ||
#include <stdio.h> | ||
#include "lib/command.h" | ||
#include "lib/sql_util.h" | ||
#include "lib/string_util.h" | ||
#include "lib/hawq_config.h" | ||
#include "test_hawq_reload.h" | ||
|
||
#include "gtest/gtest.h" | ||
|
||
using std::string; | ||
using hawq::test::SQLUtility; | ||
using hawq::test::Command; | ||
|
||
/* | ||
Test case for hawq reload <object>. This test changes the value of GUC | ||
log_min_messages to debug. Reloads the cluster and verifies if the change | ||
was reloaded successfully. After the test it resets the valueof GUC to | ||
default. | ||
*/ | ||
TEST_F(TestHawqReload,TestReloadLogMinMessages) { | ||
|
||
hawq::test::HawqConfig hawq_config; | ||
string defaultGUCValue = hawq_config.getGucValue("log_min_messages"); | ||
hawq_config.setGucValue("log_min_messages","debug"); | ||
string cmd = "hawq reload cluster -au"; | ||
Command reload(cmd); | ||
string result = reload.run().getResultOutput(); | ||
EXPECT_EQ("debug", hawq_config.getGucValue("log_min_messages")); | ||
// Reset to default | ||
hawq_config.setGucValue("log_min_messages",defaultGUCValue); | ||
Command setoriginal(cmd); | ||
string org_result = setoriginal.run().getResultOutput(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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. | ||
*/ | ||
|
||
#ifndef TEST_HAWQ_RELOAD_H | ||
#define TEST_HAWQ_RELOAD_H | ||
|
||
#include <string> | ||
#include <pwd.h> | ||
#include <fstream> | ||
#include "lib/hdfs_config.h" | ||
#include "gtest/gtest.h" | ||
|
||
class TestHawqReload: public ::testing::Test { | ||
public: | ||
TestHawqReload() { | ||
std::string user = HAWQ_USER; | ||
if(user.empty()) { | ||
struct passwd *pw; | ||
uid_t uid = geteuid(); | ||
pw = getpwuid(uid); | ||
user.assign(pw->pw_name); | ||
} | ||
conn.reset(new hawq::test::PSQL(HAWQ_DB, HAWQ_HOST, HAWQ_PORT, user, HAWQ_PASSWORD)); | ||
} | ||
~TestHawqReload() {} | ||
|
||
private: | ||
std::unique_ptr<hawq::test::PSQL> conn; | ||
}; | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,23 @@ def main(): | |
if second_arg not in cluster_type_list: | ||
print STOP_HELP | ||
sys.exit(1) | ||
# Prints deprecation warning when using old syntax "hawq stop <object> -u" to reload GUC | ||
if len(sub_args.split("-")) > 1: | ||
if "-u" in sub_args or "--reload" in sub_args or "u" in sub_args.split("-")[1]: | ||
deprecationMessage = """ | ||
hawq stop <object> -u is being deprecated and replaced by 'hawq reload <object>' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This deprecation message is not align with other messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @radarwave - I deliberately kept the messages printing different so that it is noticeable to the user, as it is a deprecation warning. |
||
Current syntax will work but please use 'hawq reload <object>' going forward. | ||
""" | ||
print deprecationMessage | ||
cmd = "%s; hawq_ctl %s %s" % (source_hawq_env, hawq_command, sub_args) | ||
result = local_run(cmd) | ||
elif hawq_command == "reload": | ||
hawq_command="stop" | ||
sub_args_list.append("-u") | ||
sub_args=" ".join(sub_args_list) | ||
if second_arg not in cluster_type_list: | ||
print RELOAD_CONFIG_HELP | ||
sys.exit(1) | ||
cmd = "%s; hawq_ctl %s %s" % (source_hawq_env, hawq_command, sub_args) | ||
result = local_run(cmd) | ||
elif hawq_command == "init": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo 'valueof'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing it out, will correct it.