Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@michaelbausor
Copy link
Contributor

Fixes #506

cc @tmatsuo @dwsupplee @jdpedrie

Some notes:

  • This is added as an option, not as the default behaviour, because that would be (I believe) a BC-break.
  • It is slightly clumsy in the DatastoreSessionHandler because it is the second optional arg, so someone who wants to pass it will also need to set the $gcLimit parameter

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 8, 2017
@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 8, 2017

Thanks for doing this, however, I think we can safely add this behavior, even it's strictly a BC-break, because the session data is not meant to be indexed as a string in any way.

How about to just automatically add the option under the cover?

/**
* Write the session data to Cloud Datastore.
*
* @param string $id Identifier used to construct a {@see Key} for the {@see Entity} to be written.

This comment was marked as spam.

This comment was marked as spam.

@dwsupplee dwsupplee added the api: datastore Issues related to the Datastore API. label Aug 8, 2017
@michaelbausor
Copy link
Contributor Author

@tmatsuo Interesting. I feel like I am not familiar enough to understand whether any of our users might be depending on the current behaviour. If the chances are negligible or zero, then I agree that making this the default makes sense, but I do think that we need to be very careful about making such decisions in our GA APIs. @jdpedrie @dwsupplee WDYT?

@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 8, 2017

@michaelbausor I would say it's negligible, very close to zero

@jdpedrie
Copy link
Contributor

jdpedrie commented Aug 8, 2017

@michaelbausor the tests are failing all over at the moment, we're looking into it. but you do have a couple of code sniffer issues which can be addressed in the meanwhile: https://travis-ci.org/GoogleCloudPlatform/google-cloud-php/jobs/262396218#L841

@codingStandardsIgnoreStart and @codingStandardsIgnoreEnd around the long lines is how we handle those.

@dwsupplee
Copy link
Contributor

I do think that we need to be very careful about making such decisions in our GA APIs

I agree wholeheartedly with this.

@tmatsuo, it seems this may be something we want to classify as a bug, WDYT? If that is the case, I am in favor of going ahead and making the fix even if it is technically a BC break.

@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 8, 2017

@dwsupplee Yeah agreed with marking this as a bug. This data should not be indexed by any means. It also causes #506.

* @return bool
*/
public function write($id, $data)
public function write($id, $data, $entityOptions = null)

This comment was marked as spam.

This comment was marked as spam.

*
* @param string $id Identifier used to construct a {@see \Google\Cloud\Datastore\Key} for the {@see \Google\Cloud\Datastore\Entity} to be written.
* @param string $data The session data to write to the {@see \Google\Cloud\Datastore\Entity}.
* @param array $entityOptions Optional arguments that will be passed to the {@see \Google\Cloud\Datastore\DatastoreClient::entity} method

This comment was marked as spam.

This comment was marked as spam.

DatastoreClient $datastore,
$gcLimit = self::DEFAULT_GC_LIMIT
$gcLimit = self::DEFAULT_GC_LIMIT,
$options = []

This comment was marked as spam.

This comment was marked as spam.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 10, 2017
@jdpedrie
Copy link
Contributor

(merged in the travis grpc fix)

@michaelbausor
Copy link
Contributor Author

I have changed the default behaviour to specify 'excludeFromIndexes' => ['data']. If a user really needs the old behaviour, it is possible to override this in the DatastoreSessionHandler constructor using the new $options arg. PTAL.

@michaelbausor
Copy link
Contributor Author

@jdpedrie Thanks for merging in the Travis fix. It looks like there are some other changes in this PR now as well - does that mean this PR should wait until those are in master?

@jdpedrie
Copy link
Contributor

jdpedrie commented Aug 10, 2017

@michaelbausor sorry about that! Weird. It appears that the other changes are from #617. But that PR was already merged, so I'm not sure why they are showing up in the diff.

I don't want to mess any more with your PR, so I won't change anything, but you could drop that commit:

$ git rebase -i upstream/master // upstream = whatever you call the googlecloudplatform/google-cloud-php remote.

Change 3625e77 from pick to drop and accept all other changes.

Again, sorry for the mess!

@michaelbausor
Copy link
Contributor Author

@jdpedrie No worries, fixed!

@jdpedrie jdpedrie added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Aug 10, 2017
Copy link
Contributor

@dwsupplee dwsupplee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Contributor

@tmatsuo tmatsuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG! Thanks!

Copy link
Contributor

@jdpedrie jdpedrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple tiny things, otherwise lg!

*
* @type array $entityOptions Default options to be passed to the
* {@see \Google\Cloud\Datastore\DatastoreClient::entity()} method when writing session data to Datastore.
* If not specified, defaults to ['excludeFromIndexes' => ['data']].

This comment was marked as spam.

This comment was marked as spam.

// Cut down to 1000
$this->gcLimit = min($gcLimit, 1000);

if (!isset($options['entityOptions'])) {

This comment was marked as spam.

This comment was marked as spam.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 11, 2017
@michaelbausor
Copy link
Contributor Author

PTAL

Copy link
Contributor

@jdpedrie jdpedrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdpedrie
Copy link
Contributor

@michaelbausor
Copy link
Contributor Author

Thanks - fixed

@dwsupplee dwsupplee merged commit 19347f5 into googleapis:master Aug 14, 2017
@jdpedrie jdpedrie mentioned this pull request Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. cla: no This human has *not* signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants