Skip to content

[HttpFoundation] save session data as binary & add lazy-connect & create table & lifetime per session #10991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented May 25, 2014

Q A
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #5483, #2067, #2382
License MIT
  1. Encoding session data was definitely the wrong solution. Session data is binary text (esp. when using other session.serialize_handler) that must stay as-is and thus must also be safed in a binary column. Base64 encoding session data just decreses performance and increases storage costs and is semantically wrong because it does not have a character encoding.
    That saving null bytes in Posgres won't work on a character column is also documented

    First, binary strings specifically allow storing octets of value zero and other "non-printable" octets (usually, octets outside the range 32 to 126). Character strings disallow zero octets, and also disallow any other octet values and sequences of octet values that are invalid according to the database's selected character set encoding.
    http://www.postgresql.org/docs/9.1/static/datatype-binary.html#DATATYPE-BINARY-TABLE

  2. Implement lazy connections that are only opened when session is used by either passing a dsn string explicitly or falling back to session.save_path ini setting.

  3. add a create table method that creates the correct table depending on database vendor. This makes the class self-documenting and standalone useable.

  4. add lifetime column to session table which allows to have different lifetimes for each session

  5. added upgrade and changelog notes

@Tobion
Copy link
Contributor Author

Tobion commented May 25, 2014

@fabpot This is ready. I added upgrade and changelog notes.

@fabpot
Copy link
Member

fabpot commented May 25, 2014

The PDO session handler is so much different than before and we are so close of 2.5 final that I'm more an more uncomfortable with those changes done now.

Basically, I see two options:

  • Merge this PR and write an extensive blog post about all the changes made to the PDO session handler, including what people need to do in their code with snippet examples (post to be published in the next couple of hours);
  • Revert the previous changes done in 2.5 for the PDO session handler, and re-merge them with this PR in 2.6 to give us more time.

@Tobion I tend to prefer the second option, but if a great blog post written today might work as well. It's really up to you.

@fabpot
Copy link
Member

fabpot commented May 25, 2014

On a side note, we did rush some big last minute changes in the past and it was rarely a good idea.

@Tobion
Copy link
Contributor Author

Tobion commented May 25, 2014

I'm ok with waiting for 2.6

@fabpot
Copy link
Member

fabpot commented May 26, 2014

@Tobion Ok, let's revert the changes. To be sure I don't forget anything, can you list here the PRs that should be reverted (IIRC, I think there was more than one)?

@Tobion
Copy link
Contributor Author

Tobion commented May 26, 2014

You only need to revert the same thing in 2.5 that you already reverted in 2.3 and 2.4: #10908

@fabpot
Copy link
Member

fabpot commented May 26, 2014

#10908 has been reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants