Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

document using BLOB data type for handler #41

Merged
merged 1 commit into from
Jun 16, 2015

Conversation

rjocoleman
Copy link
Contributor

DDJob uses PHP's serialize() function to store data in the handler column.

From the PHP docs on serialize().

Note that this is a binary string which may include null bytes, and needs to be stored and handled as such. For example, serialize() output should generally be stored in a BLOB field in a database, rather than a CHAR or TEXT field.

https://php.net/manual/en/function.serialize.php#refsect1-function.serialize-returnvalues

A common symptom of this is errors like:

Notice: unserialize(): Error at offset 2010 of 2425 bytes in /var/www/magento/current/lib/DJJob/DJJob.php on line 454

I did not change the tests as they're using the MEMORY table type which is incompatible with BLOB.

@josegonzalez
Copy link
Contributor

Why are you giving your jobs more data than record ids? Serializing a lot of data for a job seems like it's not the greatest idea?

@josegonzalez
Copy link
Contributor

Note: I would also rather just note to our users that they may optionally use blob over text fields.

@rjocoleman
Copy link
Contributor Author

Note: I would also rather just note to our users that they may optionally use blob over text fields.

I've adjusted this PR to be a note in the readme

@rjocoleman
Copy link
Contributor Author

Serializing a lot of data for a job seems like it's not the greatest idea?

why not? I don't primarily live in a PHP/MySQL world so I looked to the docs for the solution to my unserialize() issue and stopped there.. I'm naively unaware of any other issues.

I've got JSON data being used for intra-app communication and DJJob processing this, as such the JSON is being serialized and living in handler until it's processed. Large is relative, I'm looking at data <10kB

josegonzalez added a commit that referenced this pull request Jun 16, 2015
document using BLOB data type for handler
@josegonzalez josegonzalez merged commit faf00f9 into seatgeek:master Jun 16, 2015
@josegonzalez
Copy link
Contributor

Thanks for changing the message.

@rjocoleman rjocoleman deleted the blob-sql branch June 16, 2015 20:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants