All Forums Database
Duri83 17 posts Joined 01/12
29 Nov 2012
How to install external UDF libraries on Hot Standby Node (HSN)?

Hello,
Recently we had a db crash on TD14 and our HSN took over but did not take over the operation because it was missing libraries for the external (C/C++) UDFs.
Any ideas how to identify what is missing on the HSN and to install it? Is it possible to be done with TDPut?
Thanks,
GLHF,
Yuri

Fred 1096 posts Joined 08/04
01 Dec 2012

Any user or third party code needs to be installed / compiled using DDL (optionally via supplied "package" SPs) as documented in the SQL Reference "External Routine Programming" manual. That includes any common / global routines used by the UDFs.
Could someone have manually compiled code, or placed additional executable code on the node directly?

Duri83 17 posts Joined 01/12
04 Dec 2012

Hello Fred,
no, we install the UDFs with the create/replace SQL command from BTEQ. My assumption is that it only compiles the shared objects on the active nodes, not the HSN. Similar to the documentation of Teradata geospatial (Geospatial Orange Book.doc) section 3.4.4 I would assume, that the SOs are not automatically deployed and we would have to do one of:
- Start AMPs (start DBS) on HSN and redeploy the UDFs (this is somewhat not feasible)
- Use another way of deploying the SOs, which I am not aware of
GLHF,
Yuri

emilwu 72 posts Joined 12/07
04 Dec 2012

Refer to the orange book of UDF (search Teradata database user defined function User's guide)
section 2.2.3.3 Registration process for Packages. 
You can compile your code to .so (sahred library) on the server node first (refer to gcc / make how to compile a so), and then put it under a specific path which exists in system PATH variable (using put to push the file to all nodes) . 
then you can use the SP (server package) to deploy DDLs. 
Here is a DDL sample provided in the orange book
 

CREATE FUNCTION udfSubStr(
	strexp	VARCHAR(512),
	n1		INTEGER,
	n2		INTEGER
)RETURNS VARCHAR(512)
LANGUAGE C
NO SQL
SPECIFIC udf_substr3
EXTERNAL NAME 'SP!/home/udfs/substr.so'
PARAMETER STYLE SQL;

 

Duri83 17 posts Joined 01/12
05 Dec 2012

Thanks for the posts, somehow I suspect that the HSN did not work properly, because there was a kernel panic situation on the active node (our system has 2 NODEs, one of them is HSN), we will test HSN and see if all what is needed will be replicated automaticaly.
The missing files appeared on the HSN after the crash situation was resolved on the primary NODE. But since we did an patch installation, these files are different again.
The SOs that were missin are in /etc/opt/teradata/tdconfig/udflib/tdbs_1001 (SLES10).
Could someone please point me to a document or describe how can I make HSN to take operation on purpose (this way, we will be able to test also that all the network related settings like firewall are correct)?
What comes to my mind is... If my assumption in the first line is correct, would it make sense to perform replication every time, we install a patch / change external UDFs?

Duri83 17 posts Joined 01/12
27 Dec 2012

So we have learned there is an internal dbscontrol flag to copy udflib files to the HSN node whenever a UDF is (re)compiled. This is useful in our 1+1 configuration (1 working node and 1 HSN). This is because the libraries might not replicate to HSN if the working node is in a critical status (e.g. kernel panic).
Does someone know what is the proper procedure to switch to HSN on purpose (and how to switch back)?

You must sign in to leave a comment.