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

fix pgsql lob behavior #466

Closed
wants to merge 3 commits into from
Closed

fix pgsql lob behavior #466

wants to merge 3 commits into from

Conversation

qmx
Copy link
Contributor

@qmx qmx commented Jan 13, 2015

PostgreSQL may use more than one row for storing *LOB fields, hence a
transaction is always needed for ensuring consistency.

By extracting the certificate storage to its own entity, access to variants
becomes more lightweight, and cert lookup can be made lazy.

AGPUSH-1144

@qmx
Copy link
Contributor Author

qmx commented Jan 13, 2015

I'd love to hear suggestions from @edewit on how to deal with db migration for this one...

@matzew could you review please?


private byte[] certificateData;

public byte[] getCertificateData() {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we name it like getRaw() ? instead of getCertData ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm all ears, I still don't like either name, but ran out of ideas :D

Copy link
Contributor

Choose a reason for hiding this comment

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

I like raw :-)

Copy link
Member

Choose a reason for hiding this comment

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

Envoyé de mon iPhone

Le 13 janv. 2015 à 19:06, Matthias Wessendorf notifications@github.com a écrit :

In model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/Certificate.java:

@@ -0,0 +1,15 @@
+package org.jboss.aerogear.unifiedpush.api;
+
+
+public class Certificate extends BaseModel {
+

  • private byte[] certificateData;
  • public byte[] getCertificateData() {
    I like raw :-)

What about getContent ?

Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about getContent ?
Not sure - naming is hard :-) but to me content implies text, instead of binary.

How about getRawCertificate() ?

@matzew
Copy link
Contributor

matzew commented Jan 13, 2015

@sebastienblanc do you mind reviewing/testing too ? thanks!

package org.jboss.aerogear.unifiedpush.api;


public class Certificate extends BaseModel {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some simple javadoc and a license header?

@matzew
Copy link
Contributor

matzew commented Jan 14, 2015

Tested against both MySQL and PostgreSQL:
One application, with one iOS varian and 16k devices -> all good here

@sebastienblanc
Copy link
Member

I can create an app and its iOS variant but when trying to send a notification that is what I get : https://gist.github.com/sebastienblanc/77651f87529b44c3ab10

@matzew
Copy link
Contributor

matzew commented Jan 14, 2015

nice find!

On Wed, Jan 14, 2015 at 4:48 PM, Sebastien Blanc notifications@github.com
wrote:

I can create an app and its iOS variant but when trying to send a
notification that is what I get :
https://gist.github.com/sebastienblanc/77651f87529b44c3ab10


Reply to this email directly or view it on GitHub
#466 (comment)
.

Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

<discriminator-value>ios</discriminator-value>
<attributes>
<basic name="certificate">
<lob/>
<many-to-one name="certificate" fetch="LAZY">
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is actually causing the issue @sebastienblanc identified here: https://gist.github.com/sebastienblanc/77651f87529b44c3ab10

Copy link
Member

Choose a reason for hiding this comment

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

@qmx any comment on the error ?

@qmx qmx changed the title extract Certificate storage to its own table fix pgsql lob behavior Jan 21, 2015
@qmx
Copy link
Contributor Author

qmx commented Jan 21, 2015

looks like the only portable way of doing this is by just storing it as a Base64-encoded string - should work for all databases and the overhead is minimal.

@matzew @sebastienblanc could you give it a try please?

@qmx
Copy link
Contributor Author

qmx commented Jan 21, 2015

@matzew done

@matzew
Copy link
Contributor

matzew commented Jan 21, 2015

@qmx the migration, that will be on a different PR, right ?

@matzew
Copy link
Contributor

matzew commented Jan 21, 2015

and, oh - can you submit this PR agains the 1.0.x branch ? To speed up the 1.0.3 release train?

@qmx
Copy link
Contributor Author

qmx commented Jan 21, 2015

@matzew sure - looks like I've missed the [RFC] at the PR title ;)

will look into the migration now

@matzew
Copy link
Contributor

matzew commented Jan 21, 2015

yeah, the JIRA task for migration is here: https://issues.jboss.org/browse/AGPUSH-1147

@qmx
Copy link
Contributor Author

qmx commented Jan 21, 2015

@matzew at least can you confirm that it works for you?

@sebastienblanc
Copy link
Member

Tested on a fresh postgres DB 👍 Can create ios variant and send push notifications.
But we need a migration path for this as well , FYI here the log before I cleaned my DB (stacktrace when I try to create an ios variant ) https://gist.github.com/sebastienblanc/e443895d3877e5e9140e

@qmx
Copy link
Contributor Author

qmx commented Jan 22, 2015

@matzew PR for the 1.0.x series: #471

@qmx
Copy link
Contributor Author

qmx commented Jan 22, 2015

@sebastienblanc indeed, migration will be another PR, to follow shortly

@sebastienblanc
Copy link
Member

merged, thx landed 6b20f3e

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.

None yet

3 participants