Admin utilities

This section contains some examples of admin utilities used for debugging.

For all of the utilities, use the dataslice ID parameter to control whether the function is run on the host or the SPU. To run it on the SPU, run a command like the following:

SELECT * FROM _v_dual_dslice, TABLE WITH FINAL(listlogs(-1,dsid));

This command correlates the table function with the _v_dual_dslice table that exists on the SPU, causing the table function to run on the SPU and the host (unlike the previous example, which ran only on the host).

Note that the value of NZAE_DEBUG controls what is seen in the log files (0 is nothing, 1 is some information, 2 is child information, 3 is child and parent information).

Listlogs

This function takes two integers--a session ID and a dataslice ID. The session ID can be either a valid session ID or the value “-1” to indicate all sessions. The dataslice ID is ignored by the listlogs function, but is used to control the locus of execution (host or SPU, as well as dataslice). For example:

SELECT * FROM TABLE WITH FINAL(listlogs(-1,0));

The function returns the dataslice ID (DSID), the type of the log file (TYPE), the modified timestamp (MODIFIED), and the log file name (FILENAME). Table 1 shows sample output, formatted for easier reading.

Table 1. Sample Listlogs Function Output
DSID TYPE MODIFIED FILENAME
0 Remote Mode - Child Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171176744-16934.txt
0 Remote Mode - Parent Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171176744-16934.txt_parent.txt
0 Remote Mode - Child Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171178024-16934.txt
0 Remote Mode - Parent Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171178024-16934.txt_parent.txt
0 Remote Mode - Child Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171188432-16934.txt
0 Remote Mode - Parent Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171188432-16934.txt_parent.txt
0 Remote Mode - Child Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171209264-16934.txt
0 Remote Mode - Parent Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171209264-16934.txt_parent.txt
0 Remote Mode - Child Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171232280-16934.txt
0 Remote Mode - Parent Request Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-0- remote-171232280-16934.txt_parent.txt
0 Local Mode - Child Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 13975-16934.txt
0 Local Mode - Parent Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 13975-16934.txt_parent.txt
0 Local Mode - Child Stderr 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 13975-16934.txt_stderr.txt
0 Local Mode - Child Stdout 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 13975-16934.txt_stdout.txt
0 Local Mode - Child Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14031-16934.txt
0 Local Mode - Parent Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14031-16934.txt_parent.txt
0 Local Mode - Child Stderr 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14031-16934.txt_stderr.txt
0 Local Mode - Child Stdout 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14031-16934.txt_stdout.txt
0 Local Mode - Child Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14302-16934.txt
0 Local Mode - Parent Log 04/26/10
03:22 PM
/u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894- 14302-16934.txt_parent.txt
(20 rows)

Viewlog

This function takes two arguments--the file name and the dataslice ID.

SELECT * FROM TABLE WITH FINAL(viewlog('/u01/home/nz/workspaces/usr-bdrosen-
tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302-16934.txt_parent.txt',0));

The function returns the dataslice ID (DSID), the log file name (FILENAME), the slice of the file (SLICE), and the line of text (DATA). Table 2 shows the output, formatted for easier reading.

Table 2. Sample Viewlog Function Output
DSID FILENAME SLICE DATA
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 1 before nzrepReceive #1 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 2 after nzrepReceive #1 NZREP_PING (5) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 3 before nzrepReceive #2 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 4 after nzrepReceive #2 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 5 before nzrepSend #1 NZREP_METADATA (8) length=4088 nzaeaggcontroller.cpp: 403
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 6 after nzrepSend #1 nzaeaggcontroller.cpp: 408
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 7 before nzrepReceive #3 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 8 after nzrepReceive #3 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 9 before nzrepSend #2 NZREP_METADATA (8) length=4088 nzaeaggcontroller.cpp: 403
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 10 after nzrepSend #2 nzaeaggcontroller.cpp: 408
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 11 before nzrepReceive #4 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 12 after nzrepReceive #4 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 13 before nzrepSend #3 NZREP_DATA (1) length=4088 nzaeaggcontroller.cpp: 91
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 14 after nzrepSend #3 nzaeaggcontroller.cpp: 96
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 15 before nzrepReceive #5 nzaeaggcontroller.cpp: 308
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 16 after nzrepReceive #5 NZREP_DATA (1) length=4088 nzaeaggcontroller.cpp: 313
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 17 before nzrepReceive #6 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 18 after nzrepReceive #6 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 19 before nzrepSend #4 NZREP_METADATA (8) length=4088 nzaeaggcontroller.cpp: 403
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 20 after nzrepSend #4 nzaeaggcontroller.cpp: 408
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 21 before nzrepReceive #7 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 22 after nzrepReceive #7 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 23 before nzrepSend #5 NZREP_DATA (1) length=4088 nzaeaggcontroller.cpp: 213
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 24 after nzrepSend #5 nzaeaggcontroller.cpp: 218
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 25 before nzrepReceive #8 nzaeaggcontroller.cpp: 308
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 26 after nzrepReceive #8 NZREP_DATA (1) length=4088 nzaeaggcontroller.cpp: 313
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 27 before nzrepReceive #9 nzaeaggcontroller.cpp: 247
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 28 after nzrepReceive #9 NZREP_REQUEST (6) length=0 nzaeaggcontroller.cpp: 252
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 29 before nzrepSend #6 NZREP_END (3) length=0 nzaeaggcontroller.cpp: 232
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 30 after nzrepSend #6 nzaeaggcontroller.cpp: 237
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 31 before nzrepClose nzaebasecontroller.cpp: 90
0 /u01/home/nz/workspaces/usr-bdrosen\u0002tfunc/main/tmp/nzae-IDENTIFIER-0-13894-14302- 16934.txt_parent.txt 32 after nzrepClose nzaebasecontroller.cpp: 92
(32 rows)

Cleanlogs

This function takes two arguments--the session ID and the dataslice ID. It returns the dataslice ID and text detailing how many files were deleted (with a limit of 20 rows of output).

SELECT * FROM TABLE WITH FINAL(cleanlogs(16934,0)) LIMIT 20;
DSID                                 TXT
0                                    Deleted 229 log files
(1 row)