chris cbbrowne at ca.afilias.info
Mon Jul 14 14:35:55 PDT 2008
"Ibrahim Harrani" <ibrahim.harrani at gmail.com> writes:
> Hi Chris,
>
> I repaired the oid with REPAIR CONFIG on the master db(pg_dump was
> issued on master)
>
> I dropped the slave node with DROP NODE (ID =2);
> But I can't UNINSTALL slave NODE  (UNINSTALL NODE (ID =2)
>
> When I issue the commands (UNINSTALL NODE (ID =2) or the following sql
> statements,
> I always get "Table with id 54 not found"; But I believe that the
> table is exist in the system and sl_table. What could be wrong in my
> setup?
>
> Thanks.
>
> # SELECT _mycluster.uninstallNode();
> Slony-I: alterTableRestore(): Table with id 54 not found
> # SELECT _mycluster.setdroptable_int(54);
> ERROR:  Slony-I: alterTableRestore(): Table with id 54 not found
> # SELECT _mycluster.alterTableRestore(54);
> ERROR:  Slony-I: alterTableRestore(): Table with id 54 not found
>
> mydb=# SELECT * from _myusercluster.sl_table where tab_id=54;
>  tab_id | tab_reloid | tab_relname | tab_nspname | tab_set |
> tab_idxname  | tab_altered |       tab_comment
> --------+------------+-------------+-------------+---------+--------------+-------------+-------------------------
>      54 |     143265 | mytable   | myuser     |       2 | pk_mytable |
> t           | Table myuser.mytable
> (1 row)
>
>
> mydb=# SELECT * from pg_catalog.pg_tables where tablename='mytable'
> and tableowner='myuser';
>  schemaname | tablename | tableowner | tablespace | hasindexes |
> hasrules | hastriggers
> ------------+-----------+------------+------------+------------+----------+-------------
>  myuser    | mytable | myuser    |            | t          | f        | t
> (1 row)

Well, here's the code fragment that is complaining:
	-- ----
	-- Get the sl_table row and the current tables origin. Check
	-- that the table currently IS in altered state.
	-- ----
	select T.tab_reloid, T.tab_set, T.tab_altered,
			S.set_origin, PGX.indexrelid,
			@NAMESPACE at .slon_quote_brute(PGN.nspname) || ''.'' ||
			@NAMESPACE at .slon_quote_brute(PGC.relname) as tab_fqname
			into v_tab_row
			from @NAMESPACE at .sl_table T, @NAMESPACE at .sl_set S,
				"pg_catalog".pg_class PGC, "pg_catalog".pg_namespace PGN,
				"pg_catalog".pg_index PGX, "pg_catalog".pg_class PGXC
			where T.tab_id = p_tab_id
				and T.tab_set = S.set_id
				and T.tab_reloid = PGC.oid
				and PGC.relnamespace = PGN.oid
				and PGX.indrelid = T.tab_reloid
				and PGX.indexrelid = PGXC.oid
				and PGXC.relname = T.tab_idxname
				for update;
	if not found then
		raise exception ''Slony-I: alterTableRestore(): Table with id % not found'', p_tab_id;
	end if;

You can compare results via running the following query:

	select T.tab_reloid, T.tab_set, T.tab_altered,
			S.set_origin, PGX.indexrelid,
			from _myusercluster.sl_table T, _myusercluster.sl_set S,
				"pg_catalog".pg_class PGC, "pg_catalog".pg_namespace PGN,
				"pg_catalog".pg_index PGX, "pg_catalog".pg_class PGXC
			where T.tab_id = 54
				and T.tab_set = S.set_id
				and T.tab_reloid = PGC.oid
				and PGC.relnamespace = PGN.oid
				and PGX.indrelid = T.tab_reloid
				and PGX.indexrelid = PGXC.oid
				and PGXC.relname = T.tab_idxname;

Breaking that down into individual queries agaisnt individual tables:

We already have the query against sl_table:

> mydb=# SELECT * from _myusercluster.sl_table where tab_id=54;
>  tab_id | tab_reloid | tab_relname | tab_nspname | tab_set |
> tab_idxname  | tab_altered |       tab_comment
> --------+------------+-------------+-------------+---------+--------------+-------------+-------------------------
>      54 |     143265 | mytable   | myuser     |       2 | pk_mytable |
> t           | Table myuser.mytable
> (1 row)

Find the table:

   select * from pg_catalog.pg_class where oid = 143265;

Find the index:

   select * from pg_catalog.pg_index I, pg_catalog.pg_class IC 
     where indrelid = 143265 and IC.oid = I.indexrelid and
       IC.relname = 'pk_mytable';

Part of the query has to do with namespace matching; I wouldn't expect
that to be at issue.

I expect you'll find that one or another of those queries doesn't find
any tuples, and that should indicate something about why table 54
wasn't found.
-- 
select 'cbbrowne' || '@' || 'linuxfinances.info';
http://cbbrowne.com/info/lsf.html
Rules  of the  Evil Overlord  #145. "My  dungeon cell  decor  will not
feature exposed pipes.  While they add to the  gloomy atmosphere, they
are good  conductors of vibrations and  a lot of  prisoners know Morse
code." <http://www.eviloverlord.com/>


More information about the Slony1-general mailing list