Jul 222010
 

I am impressed…. my gmirror array continued to work even after the drives were renamed from da20 and da24 to ada0 and ada1. This happened when I tried out the ahci(4) for my SATA drives.

It’s the type of thing I’m striving for soon in my ZFS array.

All this started when I wanted to find out about making my ZFS array more resilient. See http://docs.freebsd.org/cgi/getmsg.cgi?fetch=663685+0+current/freebsd-stable (which is the top level post of the above mentioned link).

Jul 172010
 

I’ve been thinking about giving up my mail servers for a while. After many years of getting great satisfaction from running my own, I’m thinking of letting Google run them for me. Economies of scale means Google can do a much better job than I ever could, and for a very great price. For $12 a year, Google will be my MX servers. I won’t have to upgrade software, worry about them going offline, or think about virus scanning.

The service I refer to is Postini. Google will accept my incoming mail, then forward it to my mail servers. In short, they act as my front end. At present, I have two public mail servers (nyi.unixathome.org and supernews.unixathome.org), one of which also acts as my IMAP server (nyi). I will continue to use that IMAP server and let it accept mail from Google.

More importantly, Google can deal with all the spam filtering, virus scanning, and other mundane tasks that go with running a mail server. I have no doubt they’ll do it better than I do.

My first step towards Postini is remove nyi was a mail server and replace it with another mail server which is underutilized. I do this so I will always have two public MX servers for the domains which I have not yet moved to Postini. I want to restrict incoming smtp connections to nyi. I can’t do that if it’s acting as a public MX.

I am pretty sure I could keep using nyi as a public MX and not go through the intermediate step, but I think there is more risk associated with that choice.

I am now installing amavisd and clamav on latens. That should be done within a hour or so. Then I’ll configure Postfix in the same manner as supernews is configured. Both of them accepted incoming mail and forwarded it to nyi, which delivers the mail to my mailbox on that server and then acts as a IMAP server. By the end of this procedure, nyi will not be accepting incoming mail from anyone but my two mail servers supernews and latens.

I will also be changing the MX records for all of my domains: removing nyi as an MX and adding latens. I’ll then need to wait for the DNS changes to propagate before changing anything on nyi with respect to incoming connections.

Jul 112010
 

In a previous post, I wrote about a suspected LIMIT problem. It turns out that suspicion proved correct. The solution was to move to a nested query which limits the underlying data and then allows the outer query to grab all the associated fluff that surrounds it.

Here is the fix to the original code:

$ cvs di -ub commits_by_committer.php
Index: commits_by_committer.php
===================================================================
RCS file: /home/repositories/freshports-1/classes/commits_by_committer.php,v
retrieving revision 1.3
diff -u -b -r1.3 commits_by_committer.php
--- commits_by_committer.php    10 Feb 2008 19:17:22 -0000      1.3
+++ commits_by_committer.php    11 Jul 2010 17:36:53 -0000
@@ -89,11 +89,12 @@
                }

                $sql .= "
-         WHERE commit_log.committer = '" . AddSlashes($this->Committer) . "'
-           AND commit_log_elements.commit_log_id = commit_log.id
-           AND commit_log_elements.element_id    = element.id
-   ORDER BY 1 desc,
-                       commit_log_id";
+         WHERE commit_log.id IN (SELECT tmp.id FROM (SELECT DISTINCT CL.id, CL.commit_date
+  FROM element_pathname EP, commit_log_elements CLE, commit_log CL
+ WHERE CL.committer  = '" . AddSlashes($this->Committer) . "'
+   AND EP.element_id = CLE.element_ID
+   AND CL.id         = CLE.commit_log_id
+ORDER BY CL.commit_date DESC ";

                if ($this->Limit) {
                        $sql .= "\nLIMIT " . $this->Limit;
@@ -105,6 +106,13 @@



+
+               $sql .= ")as tmp)
+           AND commit_log_elements.commit_log_id = commit_log.id
+           AND commit_log_elements.element_id    = element.id
+   ORDER BY 1 desc,
+                       commit_log_id";
+
                if ($this->Debug) echo '</pre><pre>' . $sql . '</pre>';

                $this->LocalResult = pg_exec($this->dbh, $sql);
$
The query (greatly simplified), before, the fix was:
SELECT DISTINCT
	commit_log.commit_date - SystemTimeAdjust() AS commit_date_raw,
	commit_log.id                       AS commit_log_id,
	commit_log.encoding_losses          AS encoding_losses,
	commit_log.message_id               AS message_id,
	commit_log.committer                AS committer,
	commit_log.description              AS commit_description
   FROM commit_log, commit_log_elements, element 
  WHERE commit_log.committer = 'jb'
    AND commit_log_elements.commit_log_id = commit_log.id
    AND commit_log_elements.element_id    = element.id
ORDER BY 1 desc, commit_log_id
LIMIT 100

With the fix, the query becomes:

SELECT DISTINCT
	commit_log.commit_date - SystemTimeAdjust()        AS commit_date_raw,
	commit_log.id                                      AS commit_log_id,
	commit_log.encoding_losses                         AS encoding_losses,
	commit_log.message_id                              AS message_id,
	commit_log.committer                               AS committer,
	commit_log.description                             AS commit_description,
   FROM commit_log, commit_log_elements, element 
	  WHERE commit_log.id IN (
   SELECT tmp.id FROM (SELECT DISTINCT CL.id, CL.commit_date
     FROM commit_log CL
    WHERE CL.committer  = 'jb'
    ORDER BY CL.commit_date DESC 
    LIMIT 100
    )as tmp)
    AND commit_log_elements.commit_log_id = commit_log.id
    AND commit_log_elements.element_id    = element.id
ORDER BY 1 desc, commit_log_id