Skip to content

Commit 2248409

Browse files
committed
[#24758] YSQL: Remove time sync service requirement from the pre-reqs
Summary: Issue initially discovered because of undefined function has_aws_time_sync_service. However, we plan to remove clockbound as pre-req until the feature is Generally Available. Fixes #24758. Jira: DB-13848 Test Plan: Jenkins Reviewers: nikhil, sanketh, sgarg-yb Reviewed By: sgarg-yb Subscribers: ybase, hsunder Differential Revision: https://phorge.dev.yugabyte.com/D39473
1 parent 35356b7 commit 2248409

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

bin/yugabyted

+23-38
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ PREREQS_ERROR_MSGS = {
124124
' please free the port and restart the node.',
125125
'ycql_metric_port': 'YCQL metrics port {} is already in use. For accessing the YCQL metrics,' \
126126
' please free the port and restart the node.',
127-
'clockbound': 'Clockbound is recommended on AWS clusters. It can reduce read restart errors' \
128-
' significantly in concurrent workloads.' \
127+
'clockbound': 'Clockbound is recommended on AWS/Azure/GCP clusters.' \
128+
' It can reduce read restart errors significantly in concurrent workloads.' \
129129
' Relevant flag: --enhance_time_sync_via_clockbound.',
130130
}
131131
QUICK_START_LINKS = {
@@ -671,31 +671,19 @@ def using_time_sync_service():
671671
allow_list = ['169.254.169.123', 'metadata.google.internal', 'PHC',
672672
'aws.com', 'google.com']
673673

674-
try:
675-
# Run the chronyc sources command and capture the output
676-
result = subprocess.run(['chronyc', 'sources'], capture_output=True, text=True, timeout=1)
677-
678-
# Check if any allowed source is in the output
679-
if result.returncode == 0:
680-
for source in allow_list:
681-
if source in result.stdout:
682-
return True
683-
except (subprocess.TimeoutExpired, FileNotFoundError):
684-
return False
674+
cmd = ['chronyc', 'sources']
675+
out, err, ret_code = run_process(cmd, timeout=1, log_cmd=True)
676+
if ret_code == 0:
677+
for source in allow_list:
678+
if source in out:
679+
return True
685680

686681
return False
687682

688683
def is_phc_configured():
689-
try:
690-
# Run the chronyc sources command and capture the output
691-
result = subprocess.run(['systemctl', 'status', 'clockbound'],
692-
capture_output=True, text=True, timeout=1)
693-
694-
# Check if PHC is in the output
695-
if result.returncode == 0 and 'PHC' in result.stdout:
696-
return True
697-
except (subprocess.TimeoutExpired, FileNotFoundError):
698-
return False
684+
cmd = ['systemctl', 'status', 'clockbound']
685+
out, err, retcode = run_process(cmd, timeout=1, log_cmd=True)
686+
return retcode == 0 and 'PHC' in out
699687

700688
class ControlScript(object):
701689
def __init__(self):
@@ -2800,11 +2788,12 @@ class ControlScript(object):
28002788
prereqs_warn.add('ntp/chrony')
28012789
prereqs_warn_flag = True
28022790

2803-
# Configuring clockbound is strongly recommended for AWS clusters.
2804-
if has_aws_time_sync_service() and not self.configs.temp_data[
2805-
"enhance_time_sync_via_clockbound"]:
2806-
prereqs_warn.add('clockbound')
2807-
prereqs_warn_flag = True
2791+
# TODO: Uncomment this block when clockbound becomes GA.
2792+
# # Configuring clockbound is strongly recommended for AWS clusters.
2793+
# if using_time_sync_service() and not self.configs.temp_data[
2794+
# "enhance_time_sync_via_clockbound"]:
2795+
# prereqs_warn.add('clockbound')
2796+
# prereqs_warn_flag = True
28082797

28092798
(failed_ports, warning_ports, mandatory_port_available,
28102799
recommended_port_available) = self.check_ports()
@@ -4091,18 +4080,14 @@ class ControlScript(object):
40914080
Output.init_animation("Validating system config for clockbound...")
40924081
configure_clockbound_path = find_binary_location("configure_clockbound.sh")
40934082
cmd = ["bash", configure_clockbound_path, "--validate"]
4094-
try:
4095-
subprocess.check_call(cmd)
4096-
Output.update_animation("Clockbound configured successfully.")
4097-
except subprocess.CalledProcessError as e:
4098-
exit_code = e.returncode
4099-
Output.update_animation("Failed to validate clockbound configuration.",
4083+
out, err, retcode = run_process(cmd)
4084+
if retcode == 0:
4085+
Output.update_animation("System configured for clockbound.")
4086+
else:
4087+
Output.update_animation("Failed to validate system configuration for clockbound.",
41004088
status=Output.ANIMATION_FAIL)
41014089
Output.log_error_and_exit(
4102-
Output.make_red("ERROR") + f": Exit code: {exit_code}."
4103-
" Did you run configure_clockbound.sh script?"
4104-
)
4105-
4090+
Output.make_red("ERROR") + ": Did you run configure_clockbound.sh script?")
41064091

41074092
# Runs post_install script for linux computers.
41084093
def post_install_yb(self):

src/yb/server/clockbound_clock.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern "C" {
3434
static constexpr auto kAutoConfigNumClockboundCtxs = 0;
3535

3636
// There are multiple levels of time synchronization in increasing order
37-
// of accuracy:
37+
// of accuracy.
3838
//
3939
// 1. Random NTP servers for time synchronization:
4040
// If the cluster nodes use this method for time sync, do NOT use

0 commit comments

Comments
 (0)