Skip to main content

Bug in vertica/engine/api/start_database.py in 9.0.1 - start_list used before assignment

  • August 9, 2018
  • 1 reply
  • 3 views

jpotts
Forum|alt.badge.img
  • Participating Frequently

Line 95 contains an os.chmod command. If this command fails, e.g. for no such file or directory, the failure will be hidden by another failure - the exception handler tries to reference start_list, which is not initialized until line 96, resulting in UnboundLocalError: local variable 'start_list' referenced before assignment.

This can be worked around by adding start_list = [] between the try: on line 94 and the os.chmod on line 95.

1 reply

s_crossman
Forum|alt.badge.img
  • Participating Frequently
  • August 9, 2018

Hi,

Thanks for taking the time to report and debug. I confirmed that this is fixed in the 9.1.0 code stream as shown below. Note the change in order of start_list and os.chmod.

9.0.1
def _do_db_start(self, node, delete_corrupted_data, last_epoch, unsafe, environment, result):
"""Returns None.
Updates result with startup information
"""
try:
os.chmod(node.catalogpath, 0700)
start_list = node.startDbList(
delete_corrupted_data, last_epoch, unsafe)
db_log_path = node.dbLogPath()

9.1.0
def _do_db_start(self, node, delete_corrupted_data, last_epoch, unsafe, environment, result):
"""Returns None.
Updates result with startup information
"""
try:
start_list = node.startDbList(
delete_corrupted_data, last_epoch, unsafe)
os.chmod(node.catalogpath, 0700)
db_log_path = node.dbLogPath()

Regards,