Bucardo: Replication for PostgreSQL
Overview
Bucardo, an asynchronous multi-master replication system for PostgreSQL, was recently released by Greg Sabino Mullane. First previewed at this year’s PostgreSQL Conference in Ottawa, this program was developed for Backcountry.com to help with their complex database needs.
Bucardo allows a Postgres database to be replicated to another Postgres database, by grouping together tables in transaction-safe manner. Each group of tables can be set up in one of three modes:
- The table can be set as master-master to the other database, so that any changes to either side are then propagated to the other one.
- The table can be set up as master-slave, so that all changes made to one database are replicated to the second one.
- It can be set up in “fullcopy” mode, which simply makes a full copy of the table from the master to the slave, removing any data already on the slave.
Master-master replication is facilitated by standard conflict resolution routines, as well as the ability to drop in your own by writing small Perl routines. This custom code can alse be written to handle exceptions that often occur in master-master replication situations, such as a unique constraint …
database open-source perl postgres bucardo
RailsConf 2007 Conference Report
From Wednesday, May 17th to Saturday, May 20th, 2007, around 1600 people attended the Rails Conference (RailsConf) in beautiful Portland, Oregon, at the Oregon Convention Center. I was among them, and this is my report.
Conferences offer a varied mix of experiences to the attendee. There is the experience of a new city for many attendees, for example. While everyone refers to the technical sessions as their main draw, the social aspects of a conference are equally important and valuable. RailsConf offered plenty of socializing opportunities by providing continental breakfast, bagged salad or sandwich lunches, and coffee and soda breaks twice per day. There were also many evening parties sponsored by conference expo floor vendors and by some of Portland’s Rails development companies and the local Ruby brigade, PDX.rb.
From my informal prodding and questioning of attendees I met during these social times, it seemed almost half the attendees had come to RailsConf to get their first training in Rails. Between 45 to 50 percent of attendees I talked to had no previous real world experience with Rails or Ruby, having worked a number of years in other platforms, mostly in Java, but a …
conference rails
Get Out of Technical Debt Now!
It’s now been a year since I attended YAPC::NA 2006 in Chicago with Brian Miller and the talk that we’ve spoken of most frequently, and cited most usefully in our work, was “Get Out of Technical Debt Now!” by Andy Lester.
Most of the concepts and examples he gave were not new to us, nor to most of the attendees, I think. But his debt analogy made a coherent story out of ideas, maxims, and experiences that were previously too disjointed and differently labeled to pull together into a single comprehensible motivational package.
Are we out of technical debt? Not yet. I suppose we never will be entirely as long as we continue to work, since it’s impossible to avoid accruing some new debt. But prioritizing debts and paying off those with the highest “interest rate” and benefit means we don’t need to despair.
I highly recommend everyone read Andy’s slides, watch the video (one version has the slides incorporated), and read the Portland Pattern Repository wiki page on technical debt. Do all three, spread out over a few months, to re-motivate and remind yourself in the busy haze of daily work.
(Addendum:)
Other reading on technical …
conference development
Red Hat Enterprise Linux 4 Security Report
Mark Cox, director of the Red Hat Security Reponse Team, has published a security report of the first two years of Red Hat Enterprise Linux 4, which was released in February 2005. He discusses the vulnerabilities, threats, time to release of updates, and mitigation techniques the operating system uses.
It is interesting to note that the vast majority of security vulnerabilities affected software not used on servers: The Mozilla browser/email suite, Gaim instant messenger, xpdf, etc. Some of the server vulnerabilities would require certain user input to be exploited, such as running Links or Lynx, calling libtiff, or running a malicious binary. Others require less common setups such as Perl’s suidperl or Bluetooth drivers, or local shell access.
Nothing is completely secure, but Red Hat Enterprise Linux, configured well and kept updated, has a very good track record so far.
redhat linux
Evangelizing Test-Driven Development
I read Practices of an Agile Developer shortly after it was published, and I got pretty fired up about many ideas in it, with particular interest in test-driven development. From that point I did progressively more with testing in my day-to-day work, but everything changed for me once I went all-out and literally employed “test-driven development” for a minor project where I once wouldn’t have worried about testing at all.
If you’re not familiar with the principle, it basically boils down to this: When you are developing something, write the tests first.
I originally greeted this idea with skepticism, or viewed it as unrealistic. It also struck me as overkill for small projects. However, as I’ve been writing more tests, and finally came around to writing tests first, it’s really demonstrated its value to me. I’ll list an abstract set of benefits, and then provide a hopefully-not-too-tedious example.
Benefits
1. Cleaner interfaces
In order to test something, you test its interfaces. Which means you think through how the interface would really need to work from the user’s perspective. Of course, one should always plan a clean interface, …
testing perl
USPS changes the Web Tools Rate Calculator API
End Point offers integration with online shipping APIs to provide “live lookups” of rates.
Advantages of “live lookups”:
- Current rates
- Includes additional costs such as fuel surcharges
- No manual maintenance of rate tables
Disadvantages of “live lookups”:
- Dependent on the availability and performance of the rate service
- Planning, programming and rolling out API changes
CH CH CH CH CHANGES!
Speaking of changes, the USPS has changed shipping rates as of May 14, 2007 (non-tech-friendly details here). The changes include updates to rates, package attributes and shipping methods. These changes impact the XML-based Web Tools Rate Calculator, in some cases breaking lookups altogether. As of press time, the USPS hasn’t documented the changes to the API. Broken lookups appear to be confined mostly to international shipping.
Many of the changes represent a simplification and restructuring of international shipping methods, detailed here. This tweaking of international shipping methods is definitely an improvement — there were too many confusing options before. Unfortunately, these tweaks aren’t backwards compatible — meaning nearly all …
ecommerce shipping api
Creating a PL/Perl RPM linked against a custom Perl build
We sometimes have to install a custom Perl build without thread support, and to have some specific versions of CPAN modules, and we don’t want to affect the standard distribution Perl that lives in /usr/bin/perl
and /usr/lib/perl5
. We use standard PGDG RPMs to install PostgreSQL. We also like PL/Perl, and want PL/Perl to link against our custom Perl build.
It’s easy to achieve this with a small patch to the source RPM spec file:
--- postgresql-8.2.spec.before 2007-02-15 11:52:53.000000000 -0700
+++ postgresql-8.2.spec 2007-02-15 12:02:35.000000000 -0700
@@ -306,6 +306,7 @@
%endif
%if %plperl
--with-perl \
+ --with-libraries=/usr/local/lib/perl5/5.8.7/i386-linux/CORE/libperl.so \
%endif
%if %plpython
--with-python \
After applying that patch (adjusted for your own custom Perl build, of course), rebuild the RPM, and install the postgresql-plperl (as of PostgreSQL 8.2) or postgresql-pl (8.1 and earlier) RPM. With a service postgresql restart
, you’re ready to go.
postgres sysadmin perl
New edition of The Book of JavaScript reviewed
The Book of JavaScript (2nd edition) is a new and comprehensive introduction to the JavaScript language presented in an entertaining, practical format. I have significant practical experience with JavaScript, so I do not consider myself in the target audience for this book; however, I still found much of it useful so it will remain as a valuable reference on my bookshelf.
My full review of the book was just published at OS News.
books javascript