OpenBSD CVS

CVS log for src/usr.sbin/smtpd/Attic/ramqueue.c


[BACK] Up to [local] / src / usr.sbin / smtpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.33, Sat Jan 28 11:33:55 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: HEAD
Changes since 1.32: +0 -0 lines
FILE REMOVED

no longer needed

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jan 28 11:33:07 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.31: +0 -476 lines
Diff to previous 1.31 (colored)

- introduce the scheduler_backend API
- introduce the scheduler_ramqueue backend
- remove all occurences of ramqueue outside of the ramqueue backend
- teach runner how to use the new API

it is now possible to write custom schedulers !

ok eric@, ok chl@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jan 12 23:17:02 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.30: +1 -7 lines
Diff to previous 1.30 (colored)

we should never use ramqueue_first_envelope() as a mean to determine the
first schedulable envelope otherwise we end up with nsched wrong ...

heck, let's kill ramqueue_first_envelope() and be done with it ;)

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jan 12 22:40:16 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.29: +9 -5 lines
Diff to previous 1.29 (colored)

the ramqueue filling at startup was busted, it would load envelopes one by
one instead of doing it efficiently.

fix runner_timeout() and ramqueue_load() so that at startup smtpd fills the
ramqueue as long as there's no schedulable envelope in it, interrupts
filling if there is and resume once it's scheduled.

bug spotted by Nathanael Rensel, bug fix by me w/ help from eric@
tested by eric@ and I

Revision 1.29 / (download) - annotate - [select for diffs], Thu Jan 12 22:00:21 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.28: +14 -4 lines
Diff to previous 1.28 (colored)

now that we no longer do a stateful iteration on schedule queue, we need
to make ramqueue_next_envelope() aware of pauses in mda/mta. while at it
kill the pausing of bounces since they are reinjected in smtp and end up
paused by the mda/mta cases.

fixes an infinite loop observed by eric@ when pausing deliveries and
trying to interrupt smtpd while it attempts to fetch next envelope :)

tested by eric@ and I, ok eric@

Revision 1.28 / (download) - annotate - [select for diffs], Wed Jan 11 22:55:16 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.27: +2 -10 lines
Diff to previous 1.27 (colored)

remove stateful iteration from ramqueue, if we ever need to reintroduce it
we'll do it, but it isn't used and causes potential bugs

idea by Nathanael Rensel, diff by me, ok eric@

Revision 1.27 / (download) - annotate - [select for diffs], Wed Jan 11 22:40:36 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

in ramqueue_schedule(), do not reorder ramqueue envelopes when forcing a
reschedule of the entire queue as that can lead to an infinite loop.

bug spotted and bugfix by Nathanael Rensen, thanks !

ok eric@

Revision 1.26 / (download) - annotate - [select for diffs], Tue Nov 15 23:06:39 2011 UTC (12 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.25: +6 -11 lines
Diff to previous 1.25 (colored)

Qwalk, our API to linearly walk over the persistent queue, did not take the
queue_backend into account and assumed a filesystem with a specific layout.

This commit does plenty of things:

- make qwalk an abstraction in the queue_backend API, and impose queue
  drivers to implement qwalk_open(), qwalk() and qwalk_close();

- move previous qwalk_open(), qwalk() and qwalk_close() to the fsqueue
  driver since they were fsqueue specific ...

- make qwalk API work with msgid/evpid instead of pathnames since we're
  going to use the queue_backend API to load envelopes by evpid anyway;

- makes smtpd use *solely* the queue_backend API when manipulating the
  queue. pathnames were removed from smtpd.h and moved into the fsqueue
  which means we can now store a queue anywhere ... as long as we write
  the ten functions or so required for a queue driver ;-)

ok eric@, ok chl@

Revision 1.25 / (download) - annotate - [select for diffs], Mon Nov 7 11:14:10 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.24: +1 -24 lines
Diff to previous 1.24 (colored)

Let the smtpd process handle the enqueueing of offline messages at
startup, rather than playing tricks with the runner. This will allow
further simplifications and improvements in the runner/queue.

ok gilles@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Oct 27 14:32:57 2011 UTC (12 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.23: +3 -2 lines
Diff to previous 1.23 (colored)

Use PRI{x,d}64 in format strings instead of %llx, %lld or %qd to print {u_,}int64_t or time_t

While there, cast some time_t to int64_t

These will fix build warnings for portable smptd

ok gilles@ eric@

Revision 1.23 / (download) - annotate - [select for diffs], Sun Oct 23 17:12:41 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.22: +8 -1 lines
Diff to previous 1.22 (colored)

- smtpctl schedule no longer works, instead, use 'smtpctl schedule-id <id>'
- introduce 'smtpctl schedule-all'

ok eric@

Revision 1.22 / (download) - annotate - [select for diffs], Sun Oct 23 15:36:53 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

a few important fixes:

- use correct endianness when dumping/loading port
- use the right flag set when dumping/loading flags
- keep and use the authmap name when needed, rather than an id that
  might change when smtpd is restarted
- dump/load the authmap name with the envelope
- remove the rule struct from rq_batch as only the relay info is useful

ok gilles@

Revision 1.21 / (download) - annotate - [select for diffs], Sun Oct 23 13:03:05 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.20: +5 -2 lines
Diff to previous 1.20 (colored)

introduce Q_CORRUPT and queue_backend operation to move a message from
schedule queue to corrupt queue upon envelope loading failure.

tested by me, ok eric@

Revision 1.20 / (download) - annotate - [select for diffs], Sun Oct 23 09:30:07 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.19: +22 -20 lines
Diff to previous 1.19 (colored)

fsqueue no longer stores envelopes by dumping the structure, instead use a
couple of load/dump functions to convert to and from a human readable fmt.
while at it kill struct delivery and merge back its fields to the envelope.

this basically means we shouldn't require users to flush their queues every
time we make a change to struct envelope.

work is not done, but we're at a better state than the binary fsqueue so
we'll improve it in-tree.

has been running on my own box for the last 12 hours or so
ok eric@, chl@

Revision 1.19 / (download) - annotate - [select for diffs], Sun Sep 18 21:37:53 2011 UTC (12 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.18: +3 -4 lines
Diff to previous 1.18 (colored)

a single ramqueue message may be shared by many ramqueue envelopes to be
delivered to many ramqueue hosts, therefore storing the rq_host pointer in
the rq_msg envelope is wrong and causes baaaaad behavior.

this commit fixes reliability issues in runner process, experienced and
reported by many

Revision 1.18 / (download) - annotate - [select for diffs], Thu Sep 1 19:56:49 2011 UTC (12 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.17: +10 -17 lines
Diff to previous 1.17 (colored)

Introduce a small set of functions to manage stat counters in a
simpler and hopefully saner way.

ok gilles@ chl@

Revision 1.17 / (download) - annotate - [select for diffs], Tue Aug 30 17:06:01 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.16: +8 -1 lines
Diff to previous 1.16 (colored)

Call free() into ramqueue_remove_{batch,host,message,envelope}() instead of just after the function call.

While there, also include stats counters into their respective function.

ok gilles@

Revision 1.16 / (download) - annotate - [select for diffs], Fri Aug 26 14:39:47 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored)

add missing header needed by time()

ok gilles@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Aug 17 20:54:16 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.14: +1 -2 lines
Diff to previous 1.14 (colored)

- plug a memory leak in runner_remove_envelope()
- cosmetic change

Revision 1.14 / (download) - annotate - [select for diffs], Wed Aug 17 20:35:11 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.13: +10 -7 lines
Diff to previous 1.13 (colored)

move ramqueue_host pointer from ramqueue_envelope to ramqueue_message.
this allows us to save one pointer from each envelope stored in ram while
still allowing O(1) host lookups by ramqueue_envelope.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Aug 17 20:04:43 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.12: +22 -21 lines
Diff to previous 1.12 (colored)

- teach smtpctl remove about the new ramqueue structure
- bonus #1: O(log n) removal of envelopes
- bonus #2: removing all envelopes that have the same msgid works again

Revision 1.12 / (download) - annotate - [select for diffs], Wed Aug 17 19:36:23 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.11: +60 -18 lines
Diff to previous 1.11 (colored)

- introduce ramqueue_lookup_{host,message,envelope} to perform lookups in
  the new ramqueue structure
- introduce ramqueue_reschedule() and ramqueue_reschedule_envelope() which
  to reschedule a message or a specific envelope.

O(n) ->  O(log n)  \o/

Revision 1.11 / (download) - annotate - [select for diffs], Tue Aug 16 19:02:03 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.10: +56 -5 lines
Diff to previous 1.10 (colored)

add a host-tree and an envelope-tree in the ramqueue, they will be used to
improve scheduling and general ramqueue operations. unused yet

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jul 21 23:29:24 2011 UTC (12 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.9: +40 -1 lines
Diff to previous 1.9 (colored)

- update smtpctl.8 to reflect reality
- bring back 'smtpctl schedule' and 'smtpctl remove' to life

Things you should know:

The ramqueue data structure is not finished yet and lacks an envelope tree
for evpid lookups. I wanted to wait until I'm done but too many people are
affected by not being able to reschedule envelopes, this is a quick fix.

So right now there's an O(rrible) complexity as both commands will perform
a (possibly aborted) queue scan leading to O(n). I will make that O(log n)
soon.

Also, smtpctl remove no longer supports removing an entire message, I will
fix that very soon too.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jul 19 13:07:07 2011 UTC (12 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

fix retry delay calculation

ok gilles@

Revision 1.8 / (download) - annotate - [select for diffs], Mon May 16 21:05:52 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.7: +23 -22 lines
Diff to previous 1.7 (colored)

murder struct path and make sure smtpd uses simpler structures that do not
bring a shitload of unnecessary information everywhere. this required many
parts of smtpd to be refactored and more specifically envelope expansion.

in the process lots of code got simplified, and the envelope expansion code
has been isolated to lka_session.c with some longstanding bugs fixed.

Diff has been tested by many with no major regression reported.
armani@ spotted a bug in a setup where a domain is listed a both primary
and virtual, I will fix that in-tree as it's becoming painful to maintain
this diff out.

Revision 1.7 / (download) - annotate - [select for diffs], Sun May 1 12:57:11 2011 UTC (13 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.6: +18 -21 lines
Diff to previous 1.6 (colored)

the smtpd env is meant to be global, so do not pass it all around.

discussed with and ok gilles@

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 17 13:36:07 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.5: +16 -16 lines
Diff to previous 1.5 (colored)

cleanups, cosmethic changes, functions that should be static are now static
no functionnal change

Revision 1.5 / (download) - annotate - [select for diffs], Sun Apr 17 11:39:23 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.4: +11 -11 lines
Diff to previous 1.4 (colored)

a structure describing an envelope should be called struct envelope, not
struct message ...

Revision 1.4 / (download) - annotate - [select for diffs], Fri Apr 15 17:01:05 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.3: +12 -5 lines
Diff to previous 1.3 (colored)

kill message_id and message_uid

smtpd now has an evpid associated to each delivery message, the evpid is an
u_int64_t where the upper 32 bits are the msgid, and the 32 bits are the
envelope unique identifier for that message. this results in lots of space
saved in both disk-based and ram-based queues, but also simplifies a lot of
code.

change has been stressed on my desktop, and has ran on my MX for the entire
afternoon without a regression.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Apr 14 22:36:09 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

- implement fsqueue_message_create() and fsqueue_message_commit()
- change a few prototypes to allow bounce messages to use the
	queue_backend API until it gets merged in
- kill functions of the queue API that have been deprecated

Revision 1.2 / (download) - annotate - [select for diffs], Thu Apr 14 20:11:08 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.1: +4 -3 lines
Diff to previous 1.1 (colored)

fsqueue queue backend will implement a filesystem queue:
- fsqueue->setup() performs the queue initialization;
- fsqueue->message() controls messages;
- fsqueue->envelope() controls envelopes;

This commit brings the following to fsbackend:
fsqueue_setup(), fsqueue_message_delete(), fsqueue_envelope_load(),
fsqueue_envelope_update(), fsqueue_envelope_delete().

It also makes smtpd use the queue_backend API for these operations.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Apr 13 20:53:18 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN

following an idea from jacekm@, smtpd now uses a ram-queue instead of doing
a continuous walk on the disk-queue. the implementation differs from what
jacekm@ commited (and I backed out) a while ago in that it uses a queue and
a host tree required for upcoming features.

code will be improved in tree, it requires changes to be done in queue and
bounce API, I just wanted to commit a working version first ...

tested by todd@ and I

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.