Minor sanity check for control file extraction functions

If the control file couldn't be parsed for whatever reason, return
the default value for the requested parameter.

It'd be better to have the caller pass in a pointer to the parameter
and have the function return bool so the caller doesn't assume the
control file was read successfully. This is important for handling
DBState, where no "value unknown" default is available.
This commit is contained in:
Ian Barwick
2020-09-28 10:43:32 +09:00
parent 26b5664741
commit 147f454d32

View File

@@ -90,6 +90,8 @@ get_system_identifier(const char *data_directory)
uint64 system_identifier = UNKNOWN_SYSTEM_IDENTIFIER; uint64 system_identifier = UNKNOWN_SYSTEM_IDENTIFIER;
control_file_info = get_controlfile(data_directory); control_file_info = get_controlfile(data_directory);
if (control_file_info->control_file_processed == true)
system_identifier = control_file_info->system_identifier; system_identifier = control_file_info->system_identifier;
pfree(control_file_info); pfree(control_file_info);
@@ -122,6 +124,7 @@ get_latest_checkpoint_location(const char *data_directory)
control_file_info = get_controlfile(data_directory); control_file_info = get_controlfile(data_directory);
if (control_file_info->control_file_processed == true)
checkPoint = control_file_info->checkPoint; checkPoint = control_file_info->checkPoint;
pfree(control_file_info); pfree(control_file_info);
@@ -138,6 +141,7 @@ get_data_checksum_version(const char *data_directory)
control_file_info = get_controlfile(data_directory); control_file_info = get_controlfile(data_directory);
if (control_file_info->control_file_processed == true)
data_checksum_version = (int) control_file_info->data_checksum_version; data_checksum_version = (int) control_file_info->data_checksum_version;
pfree(control_file_info); pfree(control_file_info);