From: David E. W. <da...@ju...> - 2014-02-04 22:56:40
|
PGXC Hackers, What is the simplest way to tell if the server one has connected to is XC? Try to call pgxc_version()? `SHOW gtm_host`? Or is there something else to check, maybe something that doesn't throw an exception? Thanks, David |
From: Koichi S. <koi...@gm...> - 2014-02-05 01:27:33
|
If you're detecting a datanode, you can do like this from any available coordinator through psql: EXECUTE DIRECT ON (nodename) 'SELECT 1'; If it is successful, the datanode is connected to the coordinator and GTM is up and running. You can detect a coordinator in the same way as vanilla PostgreSQL through psql: SELECT 1; They work when GTM is up and the coordinator is connected to GTM. Anyway, without GTM up and running, the cluster won't work. Please note that pgxc_ctl monitor command goes directly to datanodes because it configures all the components. Regards; --- Koichi Suzuki 2014-02-05 David E. Wheeler <da...@ju...>: > PGXC Hackers, > > What is the simplest way to tell if the server one has connected to is XC? Try to call pgxc_version()? `SHOW gtm_host`? Or is there something else to check, maybe something that doesn't throw an exception? > > Thanks, > > David > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > Postgres-xc-developers mailing list > Pos...@li... > https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers |
From: David E. W. <da...@ju...> - 2014-02-05 01:28:59
|
On Feb 4, 2014, at 5:27 PM, Koichi Suzuki <koi...@gm...> wrote: > You can detect a coordinator in the same way as vanilla PostgreSQL through psql: > > SELECT 1; > > They work when GTM is up and the coordinator is connected to GTM. > Anyway, without GTM up and running, the cluster won't work. > > Please note that pgxc_ctl monitor command goes directly to datanodes > because it configures all the components. No, what I want to know is if I have connected to XC and not PG. D |
From: Koichi S. <koi...@gm...> - 2014-02-05 01:36:55
|
Because XC didn't change libpq at all, I cannot find explicit way if you're connecting to PG or XC. Even psql binary from PG works with XC. I'd suggest to test if pgxc_class, pgxc_node and pgxc_nodegroup catalog is available, which are all XC specifyc. To avoid name conflict (you can create table pgxc_class in PG), you can specify pgxc_class oid value, which will be release-specific though. Regards; --- Koichi Suzuki 2014-02-05 David E. Wheeler <da...@ju...>: > On Feb 4, 2014, at 5:27 PM, Koichi Suzuki <koi...@gm...> wrote: > >> You can detect a coordinator in the same way as vanilla PostgreSQL through psql: >> >> SELECT 1; >> >> They work when GTM is up and the coordinator is connected to GTM. >> Anyway, without GTM up and running, the cluster won't work. >> >> Please note that pgxc_ctl monitor command goes directly to datanodes >> because it configures all the components. > > No, what I want to know is if I have connected to XC and not PG. > > D > |
From: David E. W. <da...@ju...> - 2014-02-06 01:28:43
|
On Feb 4, 2014, at 5:36 PM, Koichi Suzuki <koi...@gm...> wrote: > Because XC didn't change libpq at all, I cannot find explicit way if > you're connecting to PG or XC. Even psql binary from PG works with > XC. I'd suggest to test if pgxc_class, pgxc_node and pgxc_nodegroup > catalog is available, which are all XC specifyc. To avoid name > conflict (you can create table pgxc_class in PG), you can specify > pgxc_class oid value, which will be release-specific though. I don’t think I need to be *that* anal. If someone creates a table named pgxc_class in pg_catalog then the problem is theirs, IMHO. Thanks, David |
From: Michael P. <mic...@gm...> - 2014-02-05 01:56:18
|
On Wed, Feb 5, 2014 at 7:56 AM, David E. Wheeler <da...@ju...> wrote: > PGXC Hackers, > > What is the simplest way to tell if the server one has connected to is XC? Try to call pgxc_version()? `SHOW gtm_host`? Or is there something else to check, maybe something that doesn't throw an exception? How do you actually do for PG itself? Do you use PG_VERSION_NUM or similar? -- Michael |
From: David E. W. <da...@ju...> - 2014-02-06 01:25:50
|
On Feb 4, 2014, at 5:56 PM, Michael Paquier <mic...@gm...> wrote: > How do you actually do for PG itself? Do you use PG_VERSION_NUM or similar? I don’t. Previously I did not have to distinguish Postgres from anything else. David |
From: Tatsuo I. <is...@po...> - 2014-02-06 02:08:29
|
> PGXC Hackers, > > What is the simplest way to tell if the server one has connected to is XC? Try to call pgxc_version()? `SHOW gtm_host`? Or is there something else to check, maybe something that doesn't throw an exception? What about this? SELECT count(*) from (SELECT has_function_privilege('%s', 'pgxc_version(text)', 'execute') WHERE EXISTS(SELECT * FROM pg_catalog.pg_proc AS p WHERE p.proname = 'pgxc_version')) AS s" Best regards, -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp |
From: David E. W. <da...@ju...> - 2014-02-06 17:12:00
|
On Feb 5, 2014, at 5:33 PM, Tatsuo Ishii <is...@po...> wrote: > What about this? > > SELECT count(*) from > (SELECT has_function_privilege('%s', 'pgxc_version(text)', 'execute') > WHERE EXISTS(SELECT * FROM pg_catalog.pg_proc AS p WHERE p.proname = 'pgxc_version')) AS s" I don’t much care about permission, so I would just do SELECT TRUE FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid WHERE nspname = 'pg_catalog' AND proname = 'pgxc_version'; Best, David |