SDP-223 | Fix EDGESERVER check in p4d_base regression. Fix an issue introduced in @2221...5. The change introduces a check of the $EDGESERVER environment var in p4d_base, which isn't reliably set when p4d_base is called. Though p4d_base now sources in backup_functions.sh, which has logic to set the EDGESERVER variable in the set_vars() function, that set_vars() function is never actually called. We can't just call the set_vars() function, because it makes 'front door' checks (i.e. calls 'p4' commands) to determine if the current instances is an edge server. There are a few problems here: 1) The p4d_base is an init script, and so can't assume that front-door commands will work, since the server might be down. So the call to determine if it is an edge server won't give the right result, and the 'p4login' call will hang unnecessarily for a while. Proposed fixes: * Rewrite the logic in set_vers that sets EDGESERVER. It should detect whether the current server is an edge server in a way that runs fast and reliably even when 'p4d' is down. Do something like 'p4d -k db.<whatever> -jd -' and find which database has server specs, and match that value in th schema to the server spec (named $SERVERID), and check that the value for the 'Services:' field of the server spec has the code for 'edge-server.' * Rewite the set_vars() so it only does innocuous things like set variables (as the name implies), and doesn't try a 'p4 login'. or anything else "active." Warnign: Need to make sure that doesn't break anything, i.e. if any place calling set_vars() relies on it doing 'p4login'. This may need some refactoring and further testing. « | |
Add Job |