Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does a wiki handle multiple simultaneous edits?

This has always lingered in the back of my mind, so I figure I might as well go ahead and ask.

How does a wiki handle multiple edits on the same content?

Here's a simplistic example of what I'm asking. Let's say that a page has the following content:

I'm a page!

And now let's say that two go to edit that page. Each person adds a sentence:

Person one:

I'm a page!
I'm a second sentence in the same page!

Person two:

I'm a page!
I'm a second sentence!

Imagine each person's second sentence being an equally relevant but different fact about the topic of the page that each person wanted to add in.

Now let's say that person one submits their changes before person two does, but person two doesn't even get a chance to see the changes that person one made. Does person two's changes overwrite those of person one when he finally goes to submit?

Is there a diff / merge algorithm that could be used for this?

like image 441
knpwrs Avatar asked Aug 05 '10 05:08

knpwrs


People also ask

Can someone else edit the same page as I'm editing?

In most cases, this won't apply to your Confluence site. Sometimes, another user may edit the same page as you're editing, at the same time you do. When this happens, Confluence will do its best to ensure nobody's changes are lost. How will I know if someone else is editing the same page as I am?

What happens if I edit the same page twice in confluence?

In most cases, this won't apply to your Confluence site. Sometimes, another user may edit the same page as you're editing, at the same time you do. When this happens, Confluence will do its best to ensure nobody's changes are lost.

What is concurrent editing in confluence?

This page covers the concurrent editing behavior in Confluence 6.0 or later when your administrator has chosen to disable collaborative editing . In most cases, this won't apply to your Confluence site. Sometimes, another user may edit the same page as you're editing, at the same time you do.

What happens when a task that is common to multiple users?

If a single task that is common to multiple users changes in any way e.g. task completed, deleted, etc., the task list of all the users who have this task will be updated. What design patterns are there that assist in implementing this function?


2 Answers

I believe Wikipedia uses a fairly simple diff/merge algorithm, similar to how most source code control software does it.

In the example you gave, it would raise a merge conflict error, because there's no way for it to know which line should come first in the final markup. The second person to save their changes would be presented with a merge error page where they have to choose how to resolve the conflict.

Keep in mind, though, that wikipedia is on the high-end of the concurrent users scale. For the majority of wikis, it would probably be acceptable to use a very simple "last save wins" algorithm, where the second person's edits simply overwrites the first person's. With the addition of history, it should be easy for the first person to spot that their changes have been overwritten and add them back again.

I believe this solution is what Stack Overflow uses. SO has an additional feature where an Ajax call is used to notify the editor if someone else comes in and modifies the page before they're finished.

like image 121
Dean Harding Avatar answered Oct 03 '22 22:10

Dean Harding


It depends on the flavor of wiki. There are many dozens or hundreds of wiki clones. Typically the second user will get a "this page has been edited by another user" error message, and then they must go reload the page and redo their edits.

A wiki certainly could merge the two edits together the same way a version control system like Subversion does. If you're familiar with the UNIX patch command, it would involve diffing user 2's edit and generating a patch which is then applied. The patch may or may not succeed; in your example there'd be a merge conflict, and so it'd be back to the old "this page has been edited by another user, you lose" error message.

like image 29
John Kugelman Avatar answered Oct 03 '22 22:10

John Kugelman