Ibrahim Harrani ibrahim.harrani at gmail.com
Mon Jul 14 15:02:56 PDT 2008
Hi Chris,

Thanks for your prompt reply.

I think, I found where is the problem. It seems that someone has been
changed the index name for this table (from pk_mytable to
mytable_pkey), so second query returns no result.

mydb=#  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';
 indexrelid | indrelid | indnatts | indisunique | indisprimary |
indisclustered | indisvalid | indkey | indclass | indexprs | indpred |
relname | relnamespace | reltype | relowner | relam | relfilenode |
reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid |
relhasindex | relisshared | relkind | relnatts | relchecks |
reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey
| relhasrules | relhassubclass | relfrozenxid | relacl | reloptions
------------+----------+----------+-------------+--------------+----------------+------------+--------+----------+----------+---------+---------+--------------+---------+----------+-------+-------------+---------------+----------+-----------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------------+--------+------------
(0 rows)


# \d mytable;
   Tabe "mydb.mytable"

--------+-----------+-----------
 dt     | date      | not null
 firmid | integer   | not null
Indexes
    "mytable_pkey" PRIMARY KEY, btree (dt, firmid)
    "fki_" btree (firmid)

#	SELECT tab_idxname FROM _mycluster.sl_table where tab_id=54;
 tab_idxname
--------------
 pk_mytable

It seems that the primary key names on the master are also changed!
How can I fix this changed primary keys?

It seems that everything has been messed up!
I would like to drop slave node totally also the master if it is necessary?

Thanks

On Tue, Jul 15, 2008 at 12:35 AM, chris <cbbrowne at ca.afilias.info> wrote:
> "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