Jorgen Austvik Jorgen Austvik's Weblog

Thursday Aug 14, 2008

I haven't had time to do much on OpenGrok lately (training for Birkebeinerrittet), but since I am evidently the only OpenGrok developer with some style (he, he) Trond has been nagging me about adding some ant rules for CheckStyle in our build system.

I added them, and Trond added the plugin to his Hudson, and after that Trond and Knut Anders has been fixing lots of the warnings, so it seems to be working fine.

If you want to be stylish too ;-), this is how you run CheckStyle on the OpenGrok code:

First you must download the CheckStyle 5.0 Zip file, and unpack it:

   cd ~/.ant/lib
   unzip ~/Desktop/checkstyle-5.0-beta01.zip
   ln -s checkstyle-5.0-beta01 checkstyle

You also have to create symbolic links to the jar files:

   cd checkstyle
   ln -s checkstyle-5.0-beta01.jar checkstyle.jar
   ln -s checkstyle-all-5.0-beta01.jar checkstyle-all.jar

Now you are ready to check how stylish you are:

   ant checkstyle

Enjoy! 

Tuesday Jul 15, 2008

I was having some problems compiling libpqxx head against PostgreSQL head on OpenSolaris with Sun Studio compilers (Sun CC bundled STL is missing iterator_traits and has a non-standard std::distance :-( - looks like we are aware of the problems with the Rough Wave STL implementation). On the libpqxx homepage, I see that my colleague Bjørn Munch has integrated libpqxx in the PostgreSQL packages for OpenSolaris while I was on vacation. Cool!

Friday Jun 06, 2008

Before I code more on OpenGrok, I need some tools. Last time I added FindBugs, and this time I add Emma, to be able to measure how well our unit tests are. Now I should be ready for some refactoring in HistoryGuru.java :-)

The procedure for running Emma analysis on our unit tests could be easier, but it is all described in README.txt.

How well are we doing? I'd say we have room for improvement. Happily, Trond has lots of spare time these days ;-)

[EMMA v2.0.5312 report, generated Fri Jun 06 00:09:25 CEST 2008]
-------------------------------------------------------------------------------
OVERALL COVERAGE SUMMARY:

[class, %]	[method, %]		[block, %]		[line, %]		[name]
23%  (51/218)!	14%  (230/1658)!	10%  (5307/55863)!	9%   (1083.2/12656)!	all classes

OVERALL STATS SUMMARY:

total packages:	22
total classes:	218
total methods:	1658
total executable files:	141
total executable lines:	12656

COVERAGE BREAKDOWN BY PACKAGE:

[class, %]	[method, %]	[block, %]	[line, %]	[name]
0%   (0/1)!	0%   (0/4)!	0%   (0/41)!	0%   (0/12)!	org.opensolaris.opengrok
0%   (0/10)!	0%   (0/57)!	0%   (0/1449)!	0%   (0/314)!	org.opensolaris.opengrok.search
0%   (0/11)!	0%   (0/95)!	0%   (0/4063)!	0%   (0/985)!	org.opensolaris.opengrok.search.context
0%   (0/26)!	0%   (0/145)!	0%   (0/4421)!	0%   (0/835)!	org.opensolaris.opengrok.search.scope
0%   (0/3)!	0%   (0/9)!	0%   (0/291)!	0%   (0/62)!	org.opensolaris.opengrok.search.scope.editor
20%  (1/5)!	3%   (2/65)!	1%   (23/2533)!	1%   (4/628)!	org.opensolaris.opengrok.analysis.java
3%   (1/36)!	0%   (1/270)!	1%   (89/8166)!	1%   (23.7/1909)!	org.opensolaris.opengrok.history
20%  (1/5)!	3%   (2/65)!	1%   (28/2366)!	1%   (3/594)!	org.opensolaris.opengrok.analysis.lisp
25%  (1/4)!	3%   (2/64)!	1%   (28/2350)!	1%   (3/588)!	org.opensolaris.opengrok.analysis.document
25%  (1/4)!	5%   (2/37)!	1%   (16/1105)!	1%   (3/290)!	org.opensolaris.opengrok.analysis.sql
20%  (1/5)!	3%   (2/65)!	1%   (44/2960)!	0%   (3/741)!	org.opensolaris.opengrok.analysis.tcl
20%  (1/5)!	3%   (2/65)!	3%   (84/2569)!	0%   (3/628)!	org.opensolaris.opengrok.analysis.c
40%  (4/10)!	21%  (9/42)!	4%   (86/2349)!	4%   (16/390)!	org.opensolaris.opengrok.analysis.executables
6%   (2/34)!	6%   (10/158)!	4%   (262/6109)!	3%   (35.8/1170)!	org.opensolaris.opengrok.index
60%  (3/5)!	25%  (31/122)!	19%  (196/1026)!	24%  (69.4/289)!	org.opensolaris.opengrok.configuration
80%  (4/5)!	39%  (26/67)!	22%  (641/2900)!	23%  (160/693)!	org.opensolaris.opengrok.analysis.sh
100% (9/9)	41%  (50/123)!	26%  (1069/4076)!	28%  (283/1008)!	org.opensolaris.opengrok.analysis.plain
67%  (6/9)!	48%  (19/40)!	29%  (249/851)!	25%  (42.2/167)!	org.opensolaris.opengrok.analysis.archive
50%  (6/12)!	49%  (34/70)!	38%  (1259/3297)!	33%  (260.5/798)!	org.opensolaris.opengrok.web
50%  (6/12)!	39%  (27/70)!	39%  (931/2405)!	27%  (120.6/445)!	org.opensolaris.opengrok.analysis
40%  (2/5)!	37%  (7/19)!	49%  (219/443)!	46%  (46/101)!	org.opensolaris.opengrok.util
100% (2/2)	67%  (4/6)!	89%  (83/93)	78%  (7/9)!	org.opensolaris.opengrok.analysis.data
-------------------------------------------------------------------------------

Sunday Jun 01, 2008

One of the best reasons to use Java as a programming language is the tools support, and one of my favorite tools is Findbugs.

So, it was only logical to add an ant target to the OpenGrok build file to make it easy to run FindBugs on the OpenGrok source.

The result? 263 warnings. Lots of them because we use JFlex, though.

How do you use it? Download findbugs-x.y.z.tar.gz, and unpack it to the opengrok/trunk/lib/findbugs-directory. Then run ant findbugs. See the OpenGrok README file for details.

Tuesday May 27, 2008

So, Trond blogged about Bazaar support in OpenGrok, and that bzr log -v was fast as a turtle on valium.

I have heard good stuff about the speed of Git, so I wanted to add Git support in OpenGrok. Trond had started on the tasked, but stopped, so he sent me a couple of files for me to complete. I added some parsing of git log, and now I can take full credit for Tronds work :-)

Now you can see beautiful output like this when you are scanning your data directories if you have some git repository there:

Scanning for repositories...
Adding Git repository: </var/opengrok/src/memcached>


Monday May 26, 2008

For some days I have been tracking down a problem which only shows itself on specific platforms and only when run in big automated settings when we try to run Slony-I tests. Off course, when we try to reproduce from our own environment, everything just works.

It turns out that due to some environment issue (PATH settings) different ps(1) commands were run on Solaris x86 and Solaris SPARC for the same user account, and that the Slony-I test suite parses ps(1) output (see _check_pid() in slony1-engine/tests/support_funcs.sh) to check if a process is still running.

I wrote a patch that used pgrep(1) to do the same in a slightly more robust way, but then Ståle - a manager! - came up to me and told me about kill -0 <pid>. How embarrassing not knowing about kill -0, and even more embarrassing being told by a manager. Anyway, now you are warned about kill -0, but knowledgeable managers I can not protect you from ;-)
 

Last week, Trond and I played with PostgreSQL as a storage engine for Memcached. Great stuff if you think that the world is moving too fast, and want to slow down a bit ;-)

He forgot to post the table we used in the database. Nothing revolutionary, but here it is: 

DROP TABLE IF EXISTS memcached;
CREATE TABLE memcached (
        key VARCHAR (250),
        expire_time INT,
        header_size INT,        
        data BYTEA,
        CONSTRAINT pk_key PRIMARY KEY (key)
);

The data column contains both the Memcached header and the data from the application, it would probably be a better idea to store the header and the data in separate columns, then the header_size column could be removed as well.


So, I guess some introduction is appropriate.

My name is Jørgen Austvik, I am 31 years old, and work as a software engineer for the database group at Sun, testing databases. I am located in Trondheim, Norway. Previously I worked on HADB, but now I work on PostgreSQL.

You can read more about this fascinating subject (me) at http://www.austvik.net/ ;-)

After being encouraged by Balaji in BarCamp Bangalore, and then now by Trond, I thought I should give blogging a shot.