As nate pointed out, the problem of new writeups mysteriously being added twice or more should be taken care of by writeup maintainence create -- the block that begins on line 20. If a node with the same author already exists in the group, it is deleted in favor of the new one, to permit updates, presumably.

Given my admittedly tenuous grasp on how the E2 engine actually works, this could result from the fact that $E2NODE{group} hasn't been updated yet for one reason or another -- if the queries are submitted at almost the same time, it's possible that the engine won't see the results of one before trying to execute the other. If this is, in fact, the case (could someone with a better understanding of the engine try to verify this, please?), we need to implement a fix at the database level.

Because MySQL doesn't support CHECK constraints on tables, we could create a unique compound key that makes sure no user can own more than one node of a certain type with the same title (for example, he can own only one writeup named Lesbians! Monkeys! Soy!, but might own a superdoc of the same name). If we try to duplicate this key, MySQL will barf, and we need to handle the error, of course -- since we know that the node exists, but that it's not in the E2NODE hash yet, we can be reasonably certain it's just been added, and ignore the error, forgetting about the INSERT we just tried to do, and pretending it never happened.

I *think* we can add this key like so:

ALTER TABLE node ADD UNIQUE KEY (type_nodetype, title, author_user);

But, again, I'm not entirely certain if this is how the node table stores writeups, etc. Rather than wrack my brain trying to read a through the 0.8 codebase, though, I decided I may as well just write this doc and get opinions, input, etc. in the hopes that someone else has better ideas than I. Anyone?