Search code examples
debuggingstored-proceduresvoltdb

Debugging VOLT DB Stored Procedure


I have voltdb installed in a remote machine. I would like to know how I can debug a stored procedure I write. To be specific I would like to see the values of different variables at different points of time. Is there any logging mechanism or displaying the content on the terminal (like raise notice in netizza).


Solution

  • This wiki page, Using Eclipse to Develop and Debug VoltDB Client Applications, on the voltdb project in Github describes how to set this up with the debugger in Eclipse.

    If you're looking for something dead simple for command line troubleshooting, there are a few options, but we don't recommend adding calls to log4j in stored procedures. This is for temporary use, and should be removed afterwards:

    1. Use System.out.println() calls in the procedure, and run VoltDB from the console to see the output. Call the procedure manually. If you make a lot of calls to the procedure, this won't be very helpful.

    2. Create a table and use inserts in the procedure to log messages, variable values, or whatever you want to track within the procedure. This can handle lots of calls, as you can query the table after running a workload, and even create a view to aggregate the results. I've used this more for things like counting nanoseconds elapsed within the execution of the procedure at various points, counting instances when certain logical points were reached within the procedure, or for counting intermediate records returned within the procedure, generally only for very complex procedures. It won't help if your procedure is resulting in an error because the inserts would be rolled back, so this has limited use.