In YottaDB r1.20, support for only a few ydb environment variables was added
(gtm_dist -> ydb_dist, gtmgbldir -> ydb_gbldir, gtm_zmaxtptime -> ydb_maxtptime and
gtmdbglvl -> ydb_dbglvl). But there are 100+ environment variables that need similar
support (e.g. gtmroutines -> ydb_routines, gtm_chset -> ydb_chset,
gtm_repl_instance -> ydb_repl_instance, etc.). That is, YottaDB should recognize all
the gtm environment variables (for backward compatibility) but also recognize the
new ydb* environment variables. If both types of variables are defined, the ydb
definition should override the gtm definition. That recognition of all env vars
is the purpose of this commit.
A new file ydb_logicalstab.h now defines all the gtm* environment variables and
the corresponding ydb* environment variables that YottaDB cares about. GT.M
environment variables could start with gtm, gtm, GTM or GTM. They could be lower
case or upper case. But the new YottaDB environment variables always start with ydb_
and are always lower case. And because of this new file, gtm_logicals.h is no longer
needed and is nixed.
As part of this, previously unused env var names like gtm_jnl_statsdb,
gtm_gvdupsetnoop are now removed.
gtm_env_init.c, gtm_env_init_sp.c (and a few others like mstack_size_init.c) are
now reworked to call new functions ydb_trans_numeric(), ydb_logical_truth_value(),
ydb_trans_log_name() which are passed an index into the environment variable name
table instead of the actual name of the env var; This way the functions will then
know the corresponding ydb and gtm prefixed env var names for the passed in index
and first check the ydb name if it exists and if not use the gtm env var.
In ydb_trans_logname(), the ydb env var is set to the gtm env var if only the latter
is defined.
All existing calls of trans_log_name() were examined and if they involved a gtm
environment variable as input, they are now converted to ydb_trans_log_name().
Calls which do not involve gtm specific environment variables continue to stay as is.
Any error message which involved an undefined environment variable now indicates both
the ydb and gtm environment variable name (ydb/gtm syntax) now that we check both
env vars and signal an undef only if both are undefined (e.g. REPLINSTUNDEF etc.).
But any error message that is issued afterwards (i.e. after verifying that at least one
of the two environment variables are defined) is now changed to indicate the correct
name (ydb or gtm) depending on which definition prevailed (e.g. LOGTOOLONG etc.).
A new function ydb_getenv() was implemented to migrate usages of getenv/GETENV. Like
ydb_trans_log_name(), this also accepts an index into the environment name arrays
(ydbenvname[] or gtmenv name[]) and looks at both env var names to decide which one
takes effect. But unlike ydb_trans_log_name(), this does not do any error handling to
keep it lightweight. This is because we need ydb_getenv() in places like the gtmsecshr
wrapper and the encryption plugin. Both would get bloated with a lot of code if
rts_error() etc. was present in ydb_getenv(). This also meant that ydb_getenv() does
not do a setenv() of the ydb* env var like ydb_trans_log_name() does (as otherwise
we would need to handle errors from the setenv()). It is upto the caller of ydb_getenv()
to handle any needed setenv(). Because ydb_getenv() in turn requires access to the
ydbenvname[] and gtmenvname[] arrays, a new file minimal_gbldefs.c holds these arrays
and since this requires ydb_logicals.h and ydb_logicals_tab.h, all these files are now
included in the encryption plugin too. While at this, a cygwin-only gtm_getenv()
function is now nixed.
Almost all existing usages of getenv/GETENV were migrated to ydb_getenv(). The remaining
ones were renamed as getenv() and the GETENV macro nixed. Some AIX-only getenv/GETENV
code blocks were removed as that is not anyways a supported platform.
gtm env var references in .hlp files were renamed to corresponding ydb env varnames.
This also involved fixing references to gtmroutines/gtm_zmaxtptime in *.hlp files to
instead be ydb_routines/ydb_maxtptime (missed out in r1.20).
Finally, almost all usages of gtm strings found in the gtmenvname[] column of
ydb_logicals_tab.h were changed to their corresponding ydb strings (ydbenvname[] column)
An exception is "gtm_sysid" in the mstr "default_sysid". That stays as is (i.e. not "ydb_sysid")
to preserve backward compatibility with GT.M since $SYSTEM is an ISV that applications use.
In YottaDB r1.20, support for only a few ydb environment variables was added (gtm_dist -> ydb_dist, gtmgbldir -> ydb_gbldir, gtm_zmaxtptime -> ydb_maxtptime and gtmdbglvl -> ydb_dbglvl). But there are 100+ environment variables that need similar support (e.g. gtmroutines -> ydb_routines, gtm_chset -> ydb_chset, gtm_repl_instance -> ydb_repl_instance, etc.). That is, YottaDB should recognize all the gtm environment variables (for backward compatibility) but also recognize the new ydb* environment variables. If both types of variables are defined, the ydb definition should override the gtm definition. That recognition of all env vars is the purpose of this commit.
A new file ydb_logicalstab.h now defines all the gtm* environment variables and the corresponding ydb* environment variables that YottaDB cares about. GT.M environment variables could start with gtm, gtm, GTM or GTM. They could be lower case or upper case. But the new YottaDB environment variables always start with ydb_ and are always lower case. And because of this new file, gtm_logicals.h is no longer needed and is nixed.
As part of this, previously unused env var names like gtm_jnl_statsdb, gtm_gvdupsetnoop are now removed.
gtm_env_init.c, gtm_env_init_sp.c (and a few others like mstack_size_init.c) are now reworked to call new functions ydb_trans_numeric(), ydb_logical_truth_value(), ydb_trans_log_name() which are passed an index into the environment variable name table instead of the actual name of the env var; This way the functions will then know the corresponding ydb and gtm prefixed env var names for the passed in index and first check the ydb name if it exists and if not use the gtm env var.
In ydb_trans_logname(), the ydb env var is set to the gtm env var if only the latter is defined.
All existing calls of trans_log_name() were examined and if they involved a gtm environment variable as input, they are now converted to ydb_trans_log_name(). Calls which do not involve gtm specific environment variables continue to stay as is.
Any error message which involved an undefined environment variable now indicates both the ydb and gtm environment variable name (ydb/gtm syntax) now that we check both env vars and signal an undef only if both are undefined (e.g. REPLINSTUNDEF etc.). But any error message that is issued afterwards (i.e. after verifying that at least one of the two environment variables are defined) is now changed to indicate the correct name (ydb or gtm) depending on which definition prevailed (e.g. LOGTOOLONG etc.).
A new function ydb_getenv() was implemented to migrate usages of getenv/GETENV. Like ydb_trans_log_name(), this also accepts an index into the environment name arrays (ydbenvname[] or gtmenv name[]) and looks at both env var names to decide which one takes effect. But unlike ydb_trans_log_name(), this does not do any error handling to keep it lightweight. This is because we need ydb_getenv() in places like the gtmsecshr wrapper and the encryption plugin. Both would get bloated with a lot of code if rts_error() etc. was present in ydb_getenv(). This also meant that ydb_getenv() does not do a setenv() of the ydb* env var like ydb_trans_log_name() does (as otherwise we would need to handle errors from the setenv()). It is upto the caller of ydb_getenv() to handle any needed setenv(). Because ydb_getenv() in turn requires access to the ydbenvname[] and gtmenvname[] arrays, a new file minimal_gbldefs.c holds these arrays and since this requires ydb_logicals.h and ydb_logicals_tab.h, all these files are now included in the encryption plugin too. While at this, a cygwin-only gtm_getenv() function is now nixed.
Almost all existing usages of getenv/GETENV were migrated to ydb_getenv(). The remaining ones were renamed as getenv() and the GETENV macro nixed. Some AIX-only getenv/GETENV code blocks were removed as that is not anyways a supported platform.
gtm env var references in .hlp files were renamed to corresponding ydb env varnames. This also involved fixing references to gtmroutines/gtm_zmaxtptime in *.hlp files to instead be ydb_routines/ydb_maxtptime (missed out in r1.20).
Finally, almost all usages of gtm strings found in the gtmenvname[] column of ydb_logicals_tab.h were changed to their corresponding ydb strings (ydbenvname[] column) An exception is "gtm_sysid" in the mstr "default_sysid". That stays as is (i.e. not "ydb_sysid") to preserve backward compatibility with GT.M since $SYSTEM is an ISV that applications use.