The Vertica Forum is getting a makeover! The site will be undergoing maintenance from Tuesday 8/13 to Friday 8/16. We appreciate your patience and cooperation during this time.

We want to get current epoch and ahm_epoch value from the vertica.log on each node.

We want to get current epoch and ahm_epoch value from the vertica.log on each node.
Anyone, please advice me how to identify these value from vertica.log

Best Answer

Answers

  • Jim_KnicelyJim_Knicely Administrator
    edited September 2018

    The CE and AHM should be the same across the cluster unless a node is down.

    dbadmin=> SELECT get_current_epoch(), get_ahm_epoch();
     get_current_epoch | get_ahm_epoch
    -------------------+---------------
                   906 |           904
    (1 row)
    

    You can find the AHM in the vertica.log file on each node with Linux commands... something like the following (I have 3 nodes, database name is test_db):

    [[email protected] ~]$ ssh vertica01 "grep \"GetClusterAHMCandidate: My local node AHM candidate =\" /home/dbadmin/test_db/v_test_db_node0001_catalog/vertica.log | tail -1" | awk 'NF>1{print $NF}'
    0x388
    
    [[email protected] ~]$ ssh vertica02 "grep \"GetClusterAHMCandidate: My local node AHM candidate =\" /home/dbadmin/test_db/v_test_db_node0002_catalog/vertica.log | tail -1" | awk 'NF>1{print $NF}'
    0x388
    
    [[email protected] ~]$ ssh vertica03 "grep \"GetClusterAHMCandidate: My local node AHM candidate =\" /home/dbadmin/test_db/v_test_db_node0003_catalog/vertica.log | tail -1" | awk 'NF>1{print $NF}'
    0x388
    

    Note that the log file stores epochs in HEX. You can convert them to integer in Linux like this:

    [[email protected] ~]$ printf '%d\n' "0x388"
    904
    

    Similarly, you can find the Current Epoch in Vertica logs...

    [[email protected] v_test_db_node0001_catalog]$ ssh vertica01 "grep \"Commit Complete: Txn:\" /home/dbadmin/test_db/v_test_db_node0001_catalog/vertica.log | tail -1" | awk '{print $12}'
    0x38a
    
    [[email protected] v_test_db_node0001_catalog]$ ssh vertica02 "grep \"Commit Complete: Txn:\" /home/dbadmin/test_db/v_test_db_node0002_catalog/vertica.log | tail -1" | awk '{print $12}'
    0x38a
    
    [[email protected] v_test_db_node0001_catalog]$ ssh vertica03 "grep \"Commit Complete: Txn:\" /home/dbadmin/test_db/v_test_db_node0003_catalog/vertica.log | tail -1" | awk '{print $12}'
    0x38a
    
    [[email protected] v_test_db_node0001_catalog]$ printf '%d\n' "0x38a"
    906
    
  • Hi,

    Best method is to look for Epoch.log file which is located under your catalog directory:

    catalog//v___catalog/Epoch.log

  • Jim_KnicelyJim_Knicely Administrator
    edited September 2018

    Sure!

    But the Epoch.log file, which is used during recovery to indicate the latest epoch that contains a complete set of data, is only there when the DB or node was shut down cleanly. It's not there on an up DB or after a crash.

    Examples:

    DB shut down cleanly (Epoch.log created):

    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  startup.log  vertica.log
    
    [[email protected] v_test_db_node0001_catalog]$ admintools -t stop_db -d test_db
    Info: no password specified, using none
            Connecting to database
            Issuing shutdown command to database
    Database test_db stopped successfully
    
    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  Epoch.log  startup.log  vertica.log
    

    Node shut down cleanly, after restarting the DB (Epoch.log created):

    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  startup.log  vertica.log
    
    [[email protected] v_test_db_node0001_catalog]$ admintools -t stop_node -s vertica01
    *** Forcing host shutdown ***
            Sending host shutdown command to '192.168.2.200'
    
    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  Epoch.log  startup.log  vertica.log
    

    DB node killed, after restarting node from previous example (Epoch.log NOT created):

    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  startup.log  vertica.log
    
    [[email protected] v_test_db_node0001_catalog]$ ps -ef | grep [c]atalog
    dbadmin   15869      1  0 08:59 pts/0    00:00:00 /opt/vertica/spread/sbin/spread -c /home/dbadmin/test_db/v_test_db_node0001_catalog/spread.conf -D /opt/vertica/spread/tmp
    dbadmin   15872      1 12 08:59 ?        00:00:10 /opt/vertica/bin/vertica -D /home/dbadmin/test_db/v_test_db_node0001_catalog -C test_db -n v_test_db_node0001 -h 192.168.2.200 -p 5433 -P 4803 -Y ipv4
    dbadmin   15913  15872  0 08:59 ?        00:00:00 /opt/vertica/bin/vertica-udx-zygote 14 3 15872 debug-log-off /home/dbadmin/test_db/v_test_db_node0001_catalog/UDxLogs 60 15 0
    
    [[email protected] v_test_db_node0001_catalog]$ kill -9 15869 15872 15913
    
    [[email protected] v_test_db_node0001_catalog]$ admintools -t view_cluster -d test_db
     DB      | Host          | State
    ---------+---------------+-------
     test_db | 192.168.2.200 | DOWN
     test_db | 192.168.2.201 | UP
     test_db | 192.168.2.202 | UP
    
    [[email protected] v_test_db_node0001_catalog]$ ls *.log
    bootstrap-catalog.log  editor.log  startup.log  vertica.log
    
  • Hello Jim,

    thanks for the clarification. In our case, most of the time, we find this file in our system so it is easy for us to use it.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.