[Mailman-Users] Adding backup to multi-server config

Mark Sapiro mark at msapiro.net
Sun Dec 23 22:08:57 CET 2012


On 12/18/2012 11:15 AM, Jeff Taylor wrote:
> 
> From an initial glance, I was thinking of having a configurable Delay
> variable in mm_cfg.py, specified in seconds, then qrunner could use the
> timestamp on the queued messages and only process the ones which were
> older than Delay.  This backup machine would *not* have the qrunner
> slices patch applied to it, as it should be processing any message that
> doesn't get handled by the primary servers.
> 
> Does this sound plausible?


Yes.


> Unfortunately I know nothing about python,
> nor the specifics of mailman's code, so I'm not sure if this would be an
> easy change that someone could give me the code for... but any help is
> appreciated.


Assuming you have something like

QRUNNER_MESSAGE_IS_OLD_DELAY = minutes(2)

in mm_cfg.py for the backup machine and either no mention or something like

QRUNNER_MESSAGE_IS_OLD_DELAY = None

in mm_cfg.py/Defaults.py for the other machines, you could then patch
Mailman/Queue/Switchboard.py as follows:

Find the section in the definition of the files() method that looks like

            if ext <> extension:
                continue
            when, digest = filebase.split('+')
            # Throw out any files which don't match our bitrange.  BAW: test
            # performance and end-cases of this algorithm.  MAS: both
            # comparisons need to be <= to get complete range.
            if lower is None or (lower <= long(digest, 16) <= upper):
                key = float(when)
                while times.has_key(key):
                    key += DELTA
                times[key] = filebase

and add the following

        now = time.time()
        age = now - float(when)
        # Only process defined 'old' entries.
        if not (
                hasattr(mm_cfg, 'QRUNNER_MESSAGE_IS_OLD_DELAY') and
                mm_cfg.QRUNNER_MESSAGE_IS_OLD_DELAY and
                age > mm_cfg.QRUNNER_MESSAGE_IS_OLD_DELAY):
            continue

between

            when, digest = filebase.split('+')

and

            # Throw out any files which don't match our bitrange.  BAW: test

Also, Assuming you have patched mailmanctl as indicated at
<http://mail.python.org/pipermail/mailman-users/2008-March/060753.html>,
the mm_cfg.py QRUNNERS entries for the backup machine should look like

QRUNNERS = [
    ('ArchRunner',     1,0,1), # messages for the archiver
    ...
    ]

i.e., the backup machine should be set up to be machine 0 of 1 machines.
The actual number of slices for a given runner on this machine (the
first '1' in '1,0,1' above) could be greater than 1, but you probably
don't want that.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list