agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Is CREATE TABLE non-blocking ?
6+ messages / 4 participants
[nested] [flat]

* Is CREATE TABLE non-blocking ?
@ 2014-07-23 10:33  Benjamin Dugast <bdugast@excilys.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Benjamin Dugast @ 2014-07-23 10:33 UTC (permalink / raw)
  To: pgsql-sql

Hello,

We have an issue with tables creations in our application.

We think CREATE TABLE returns before the tables are created. Because this
looks like a non-blocking operation, our inserts (in a callback) are
actually happening before the tables are created.

We tried to use a Thread.sleep() just before the insert and it works but we
can't stay with this.

What can we do to avoid this problem?

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Is CREATE TABLE non-blocking ?
@ 2014-07-23 13:43  hubert depesz lubaczewski <depesz@gmail.com>
  parent: Benjamin Dugast <bdugast@excilys.com>
  1 sibling, 1 reply; 6+ messages in thread

From: hubert depesz lubaczewski @ 2014-07-23 13:43 UTC (permalink / raw)
  To: Benjamin Dugast <bdugast@excilys.com>; +Cc: pgsql-sql

No, it's not.
What might happen, though, is that you call your callback before the
transaction with create table got committed.

depesz


On Wed, Jul 23, 2014 at 12:33 PM, Benjamin Dugast <bdugast@excilys.com>
wrote:

> Hello,
>
> We have an issue with tables creations in our application.
>
> We think CREATE TABLE returns before the tables are created. Because this
> looks like a non-blocking operation, our inserts (in a callback) are
> actually happening before the tables are created.
>
> We tried to use a Thread.sleep() just before the insert and it works but
> we can't stay with this.
>
> What can we do to avoid this problem?
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Is CREATE TABLE non-blocking ?
@ 2014-07-23 14:18  David G Johnston <david.g.johnston@gmail.com>
  parent: Benjamin Dugast <bdugast@excilys.com>
  1 sibling, 0 replies; 6+ messages in thread

From: David G Johnston @ 2014-07-23 14:18 UTC (permalink / raw)
  To: pgsql-sql

Benjamin Dugast wrote
> Hello,
> 
> We have an issue with tables creations in our application.
> 
> We think CREATE TABLE returns before the tables are created. Because this
> looks like a non-blocking operation, our inserts (in a callback) are
> actually happening before the tables are created.
> 
> We tried to use a Thread.sleep() just before the insert and it works but
> we
> can't stay with this.
> 
> What can we do to avoid this problem?

Nothing in the server is asynchronous (expect maybe notify/listen) but that
doesn't prevent you from interacting with the server in an asynchronous way
client-side.

Showing code usually helps people provide suggestions on how to avoid a
problem.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/Is-CREATE-TABLE-non-blocking-tp5812506p5812524.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Is CREATE TABLE non-blocking ?
@ 2014-07-23 15:13  Benjamin Dugast <bdugast@excilys.com>
  parent: hubert depesz lubaczewski <depesz@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Benjamin Dugast @ 2014-07-23 15:13 UTC (permalink / raw)
  To: hubert depesz lubaczewski <depesz@gmail.com>; +Cc: pgsql-sql

We finally solved our problem,
Thanks for your help.


2014-07-23 15:43 GMT+02:00 hubert depesz lubaczewski <depesz@gmail.com>:

> No, it's not.
> What might happen, though, is that you call your callback before the
> transaction with create table got committed.
>
> depesz
>
>
> On Wed, Jul 23, 2014 at 12:33 PM, Benjamin Dugast <bdugast@excilys.com>
> wrote:
>
>> Hello,
>>
>> We have an issue with tables creations in our application.
>>
>> We think CREATE TABLE returns before the tables are created. Because this
>> looks like a non-blocking operation, our inserts (in a callback) are
>> actually happening before the tables are created.
>>
>> We tried to use a Thread.sleep() just before the insert and it works but
>> we can't stay with this.
>>
>> What can we do to avoid this problem?
>>
>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Is CREATE TABLE non-blocking ?
@ 2014-07-23 15:52  Rob Sargent <robjsargent@gmail.com>
  parent: Benjamin Dugast <bdugast@excilys.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Rob Sargent @ 2014-07-23 15:52 UTC (permalink / raw)
  To: pgsql-sql

On 07/23/2014 09:13 AM, Benjamin Dugast wrote:
> We finally solved our problem,
> Thanks for your help.
>
>
> 2014-07-23 15:43 GMT+02:00 hubert depesz lubaczewski <depesz@gmail.com 
> <mailto:depesz@gmail.com>>:
>
>     No, it's not.
>     What might happen, though, is that you call your callback before
>     the transaction with create table got committed.
>
>     depesz
>
>
>     On Wed, Jul 23, 2014 at 12:33 PM, Benjamin Dugast
>     <bdugast@excilys.com <mailto:bdugast@excilys.com>> wrote:
>
>         Hello,
>
>         We have an issue with tables creations in our application.
>
>         We think CREATE TABLE returns before the tables are created.
>         Because this looks like a non-blocking operation, our inserts
>         (in a callback) are actually happening before the tables are
>         created.
>
>         We tried to use a Thread.sleep() just before the insert and it
>         works but we can't stay with this.
>
>         What can we do to avoid this problem?
>
>
>
And the solutions was....

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Is CREATE TABLE non-blocking ?
@ 2014-07-24 08:36  Benjamin Dugast <bdugast@excilys.com>
  parent: Benjamin Dugast <bdugast@excilys.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Benjamin Dugast @ 2014-07-24 08:36 UTC (permalink / raw)
  To: hubert depesz lubaczewski <depesz@gmail.com>; +Cc: pgsql-sql

So the solution was a simple problem in our program that send some INSERT
requests before we actually CREATE our tables.

We didn't figured out this problem on our first test system because it was
really fast.
On our second test environment that is much slower, the application shut
down instantly because of the tables were not created.


2014-07-23 17:13 GMT+02:00 Benjamin Dugast <bdugast@excilys.com>:

> We finally solved our problem,
> Thanks for your help.
>
>
> 2014-07-23 15:43 GMT+02:00 hubert depesz lubaczewski <depesz@gmail.com>:
>
> No, it's not.
>> What might happen, though, is that you call your callback before the
>> transaction with create table got committed.
>>
>> depesz
>>
>>
>> On Wed, Jul 23, 2014 at 12:33 PM, Benjamin Dugast <bdugast@excilys.com>
>> wrote:
>>
>>> Hello,
>>>
>>> We have an issue with tables creations in our application.
>>>
>>> We think CREATE TABLE returns before the tables are created. Because
>>> this looks like a non-blocking operation, our inserts (in a callback) are
>>> actually happening before the tables are created.
>>>
>>> We tried to use a Thread.sleep() just before the insert and it works but
>>> we can't stay with this.
>>>
>>> What can we do to avoid this problem?
>>>
>>
>>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2014-07-24 08:36 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 10:33 Is CREATE TABLE non-blocking ? Benjamin Dugast <bdugast@excilys.com>
2014-07-23 13:43 ` hubert depesz lubaczewski <depesz@gmail.com>
2014-07-23 15:13   ` Benjamin Dugast <bdugast@excilys.com>
2014-07-23 15:52     ` Rob Sargent <robjsargent@gmail.com>
2014-07-24 08:36     ` Benjamin Dugast <bdugast@excilys.com>
2014-07-23 14:18 ` David G Johnston <david.g.johnston@gmail.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox