Archive for the ‘Uncategorized’ Category

Postgres ERROR: tuple already updated by self on deleting duplicate rows

Thursday, July 1st, 2010 by Alexander Schöcke

We’ve had some serious hassle with duplicate row issues on some of our PostgreSQL databases.

While simply deleting the rows worked for most of the issues, some of them were just unable to delete. Trying to delete or update them resulted in the curious error message: Postgres ERROR: tuple already updated by self on deleting duplicate rows.

The only way for us to delete these row was to find differences between the rows. Unfortunately, they were completely identical, including oid values. After some search on the internet, we found a solution:

1
2
SELECT ctid, *
FROM TABLE

ctid here holds the block and item number of the file on the hard disk, which contains the table row. This id was different for both of the rows opposed to all the other fields. Thus we were able to delete the row:

1
2
3
DELETE FROM TABLE
WHERE id = 123
AND ctid = '(2134,1234)'

We hope this blog article can help out people who are having the same hard time as we had.

XMPP-BOSH and JMeter

Friday, March 19th, 2010 by Stephan Maihöfer

We recently had to stresstest our infrastructure to find some bottlenecks and general misconfiguration as well as ejabberd weirdness. Since it generally is not the best idea to “test live” I hacked up a little test-plan for Apaches JMeter, a tool for load testing of Webservers/-sites. I thought this would be a nice way to test the performance of your XMPP-BOSH infrastructure.

The plan has two authentication schemes, the first one being plain XMPP over BOSH, the second one is using “HTTP prebinding” to get the session id, request-id and JID. It has some very basic tasks like fetching the roster, sending presence, idling, joining MUC-Rooms and writing messages which it calls randomly in each thread iteration. The idea is to mimic a “normal” XMPP session in a somewhat automated way.

You may have to tweak it to your needs but in general most of the stuff that you would need to adjust is in the “User Defined Variables”, so check there first.

If you write your own tasks or plans it would be nice to hear back from improvements to this little hack.

Feel free to use it for whatever you can use it for:

JMeter Test Plan for XMPP over BOSH