Writing to sessions unfortunately takes forever in mysql.

I think it would be awesome if this was ported back to D6.

Files: 
CommentFileSizeAuthor
#13 mongodb_session_1007974_13.patch9.77 KBcrea
FAILED: [[SimpleTest]]: [MySQL] 1 pass(es), 1 fail(s), and 0 exception(es).
[ View ]
#10 mongdob_session_1007974_10.patch9.75 KBcrea
Test request sent.
[ View ]
#6 mongodb_session_1007974_6.patch9.66 KBcrea
Test request sent.
[ View ]
#3 mongodb_session_1007974.patch15.34 KBcrea
Test request sent.
[ View ]
#4 mongodb_session_1007974.patch15.26 KBcrea
Test request sent.
[ View ]
#1 sessions2.patch19.91 KBte-brian
Test request sent.
[ View ]
#1 pressflow-session.patch.txt13.33 KBte-brian

Comments

StatusFileSize
new13.33 KB
new19.91 KB
Test request sent.
[ View ]

Here is my first stab at a 'backport'.

This is for testing and debugging only. I left in some debugging logic I was using in case someone needs to do some debugging on their own.

Some Notes:

- This was developed and tested in a pressflow install. As such it implements and uses some functions that only pressflow has. However, these functions only live in mongodb_session.inc, so in theory this should work with core drupal as well (please test).

- If you want to test this in a pressflow install you will have to apply the included patch which moves all the drupal_session_* functions from bootstrap.inc to session.inc. This allows mongodb_session.inc to override them, since they contain db_query writes. We will need to petition the guys at four kitchens to apply this patch once we are happy with this module.

Enjoy

Status:Active» Needs work

The patch is too old

StatusFileSize
new15.34 KB
Test request sent.
[ View ]

Attaching my version of the patch. Depends on #1179402: Define REQUEST_TIME for backports for REQUEST_TIME support. Other than REQUEST_TIME, it follows D6 in every aspect: no lazy sessions, https stuff, etc.
I think for Pressflow its better to create separate .inc file

Category:feature» task
Status:Needs work» Needs review
StatusFileSize
new15.26 KB
Test request sent.
[ View ]

Better patch

Status:Needs review» Needs work

Status:Needs work» Needs review
StatusFileSize
new9.66 KB
Test request sent.
[ View ]

Updated patch: no REQUEST_TIME dependency, no tests, variable collection name.
Btw, previous version worked for me without issues.

I wonder whether :

- it makes sense to create this version for core instead of Pressflow: can you really imagine a MongoDB deployment on a non-Pressflow instance ?
- we can have a test suite before committing

I'm using D6 core myself :P

Got errors when i had no session.

My workaround:

$user = mongodb_collection(variable_get('mongodb_session', 'session'))->findOne(array('sid' => $sid));

if($user)
$user = (object)$user;

If this is not changed it tries to get the not set variable $user->uid and throws an exception.

StatusFileSize
new9.75 KB
Test request sent.
[ View ]

@dob_
You said you are using Pressflow. I wonder how you make this work, because Pressflow has different session functions and stuff (same as D7) and this patch is only for D6

I've encountered "non utf8 string" exceptions with my last patch. So I switched to using MongoBinData

There's a bug in the previous patch: I forgot to unpack binary data for anonymous sessions.

Status:Needs review» Needs work

Status:Needs work» Needs review
StatusFileSize
new9.77 KB
FAILED: [[SimpleTest]]: [MySQL] 1 pass(es), 1 fail(s), and 0 exception(es).
[ View ]

Status:Needs review» Needs work

The last submitted patch, mongodb_session_1007974_13.patch, failed testing.

Status:Needs work» Reviewed & tested by the community

The d.o testbot doesn't have mongodb installed so obviously the test fails. I re-ran the test in my local environment with mongodb installed and all tests passed. Furthurmore, this patch seems to work great. Please commit!

Status:Reviewed & tested by the community» Needs work

I take it all back. This implementation is broken.

It puts the *entire* user object into mongo, then, when the session is instantiated, it does this:

global $user;
$user = $user_from_mongo;

This is bad because it's impossible to update a user without instantiating a session for that user. Expect many things to mysteriously break.

do not use this patch.

AFAIR, the patch doesn't do anything different from the core D6, but I'll double check when I have time.

Yeah, #16 makes sense. Original code gets user object from the user table.