Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Alex Peshkoff via Firebird-devel

On 6/2/22 14:45, Adriano dos Santos Fernandes wrote:

On 02/06/2022 08:08, Dimitry Sibiryakov wrote:

Alex Peshkoff via Firebird-devel wrote 02.06.2022 13:01:

   It is "ALTER TABLE" which must be executed on replica. Otherwise
you'll have problem with ALTER TABLE ADD FIELD.

Is it impossible to analyze clauses of statement?

   Theoretically - yes. On practice it would require full Firebird SQL
parser which is hard. Simpler would be to downgrade the "missing
tablespace" error to a warning if the database is in replica mode or SQL
is performed by Applier.


Commands are replicated in text and executed in replica.

The replica execution could ignore things when are running a replicated
command.

I see no difficulty there.


Yes. Moreover - if ALTER TABLE has more clauses (like ADD FIELD) in 
addition to tablespaces related, only that tablespaces related clauses 
to be skipped.





Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Adriano dos Santos Fernandes
On 02/06/2022 08:08, Dimitry Sibiryakov wrote:
> Alex Peshkoff via Firebird-devel wrote 02.06.2022 13:01:
>>>   It is "ALTER TABLE" which must be executed on replica. Otherwise
>>> you'll have problem with ALTER TABLE ADD FIELD.
>>
>> Is it impossible to analyze clauses of statement?
> 
>   Theoretically - yes. On practice it would require full Firebird SQL
> parser which is hard. Simpler would be to downgrade the "missing
> tablespace" error to a warning if the database is in replica mode or SQL
> is performed by Applier.
> 

Commands are replicated in text and executed in replica.

The replica execution could ignore things when are running a replicated
command.

I see no difficulty there.


Adriano


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Dimitry Sibiryakov

Alex Peshkoff via Firebird-devel wrote 02.06.2022 13:01:
  It is "ALTER TABLE" which must be executed on replica. Otherwise you'll have 
problem with ALTER TABLE ADD FIELD.


Is it impossible to analyze clauses of statement?


  Theoretically - yes. On practice it would require full Firebird SQL parser 
which is hard. Simpler would be to downgrade the "missing tablespace" error to a 
warning if the database is in replica mode or SQL is performed by Applier.


--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Alex Peshkoff via Firebird-devel

On 6/2/22 13:03, Dimitry Sibiryakov wrote:

Alex Peshkoff via Firebird-devel wrote 02.06.2022 9:31:


ALTER TABLE SET TABLESPACE is tablespaces-related DDL operator - i.e. 
it should not be executed on replica. Why conflict?


  It is "ALTER TABLE" which must be executed on replica. Otherwise 
you'll have problem with ALTER TABLE ADD FIELD.




Is it impossible to analyze clauses of statement?




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Dimitry Sibiryakov

Alex Peshkoff via Firebird-devel wrote 02.06.2022 9:31:


ALTER TABLE SET TABLESPACE is tablespaces-related DDL operator - i.e. it should 
not be executed on replica. Why conflict?


  It is "ALTER TABLE" which must be executed on replica. Otherwise you'll have 
problem with ALTER TABLE ADD FIELD.


--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Alex Peshkoff via Firebird-devel

On 6/2/22 10:14, Ilya Eremin wrote:

Hello!
The last tablespaces proposal says:
> Tablespaces are excluded from replication because it's physical layout
> of a database and a replica may have another one.

which means that tablespaces-related DDL operators won't be executed 
on a replica. But some conflicts may happen, for example, when a table 
is being moved to another tablespace via ALTER TABLE SET TABLESPACE.


ALTER TABLE SET TABLESPACE is tablespaces-related DDL operator - i.e. it 
should not be executed on replica. Why conflict?


If the tablespace doesn't exist in a replica, the statement will fail. 
The tablespace should be created in a replica before the statement is 
executed.


It is possible to do it in another way: replicate tablespaces-related 
DDL to have the same set of tablespaces in a replica. The main problem 
here is the path to a tablespace file. It still can be absolute (will 
work if the path is also valid for a replica) or relative. It might be 
helpful to use directory aliases which can be set in some 
configuration file. And this is a downside - need to edit the 
configuration file on a replica(s).


I do not think that such need is too big trouble. When one wants to 
combine replication and tablespaces that does require some efforts, 
including configuration.


Which way is better for default behaviour? Would be good to hear 
opinions on this.




Ideally use of tablespaces in replication should be configurable. One 
wants to quickly setup replica and forget about configuration issues, 
other wants to have exact copy including tablespaces. Someone else may 
use on replica another tablespaces set in order to optimize performance 
in different way from master database. Why force everyone to go same way?





Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Tablespaces proposal

2022-06-02 Thread Ilya Eremin

Hello!
The last tablespaces proposal says:
> Tablespaces are excluded from replication because it's physical layout
> of a database and a replica may have another one.

which means that tablespaces-related DDL operators won't be executed on 
a replica. But some conflicts may happen, for example, when a table is 
being moved to another tablespace via ALTER TABLE SET TABLESPACE. If the 
tablespace doesn't exist in a replica, the statement will fail. The 
tablespace should be created in a replica before the statement is executed.


It is possible to do it in another way: replicate tablespaces-related 
DDL to have the same set of tablespaces in a replica. The main problem 
here is the path to a tablespace file. It still can be absolute (will 
work if the path is also valid for a replica) or relative. It might be 
helpful to use directory aliases which can be set in some configuration 
file. And this is a downside - need to edit the configuration file on a 
replica(s).
Which way is better for default behaviour? Would be good to hear 
opinions on this.


--
Ilya Eremin



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel