Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add REPLICA MODE to the output of the isql SHOW DATABASE command #7425

Closed
sim1984 opened this issue Dec 16, 2022 · 12 comments
Closed

Add REPLICA MODE to the output of the isql SHOW DATABASE command #7425

sim1984 opened this issue Dec 16, 2022 · 12 comments

Comments

@sim1984
Copy link

sim1984 commented Dec 16, 2022

Now, to find out in what mode the current database is, one of the queries needs to be executed:

SELECT MON$REPLICA_MODE FROM MON$DATABASE;

or

SELECT RDB$GET_CONTEXT('SYSTEM', 'REPLICA_MODE') FROM RDB$DATABASE;

However, we have a nice SHOW DATABASE command in isql that shows a lot of things, but not the replication mode:

SQL> show database;
Database: inet://localhost/horses
        Owner: SYSDBA
PAGE_SIZE 16384
Number of DB pages allocated = 142752
Number of DB pages used = 139414
Number of DB pages free = 3338
Sweep interval = 20000
Forced Writes are ON
Transaction - oldest = 1044
Transaction - oldest active = 1045
Transaction - oldest snapshot = 1045
Transaction - Next = 1048
ODS = 13.0
Database not encrypted
Wire crypt plugin: ChaCha64
Creation date: Dec 14, 2022 15:03:28 GMT
Protocol version = 17
Default Character set: UTF8
SQL SECURITY DEFINER

In addition, it would be nice to know if replication is enabled at all with the command:

ALTER DATABASE
ENABLE PUBLICATION;

What can be done with a request:

SELECT RDB$ACTIVE_FLAG
FROM RDB$PUBLICATIONS
WHERE RDB$PUBLICATION_NAME = 'RDB$DEFAULT';
@dyemanov
Copy link
Member

Agreed about the replica mode. As for publication state, I'm not that sure. Multiple (named) publications will be allowed in future versions, with ALTER DATABASE managing only the default one (as a shortcut command). Why should we report status of the default publication but ignore the others? Replication may be working but you'll see it as inactive. I'd rather go for explicit SHOW PUBLICATIONS | SHOW PUBLICATION <name>commands instead, maybe with SHOW PUBLICATION (without name) showing the default publication.

@sim1984
Copy link
Author

sim1984 commented Dec 16, 2022

Commands SHOW PUBLICATIONS | SHOW PUBLICATION <name> is a good idea.

@dyemanov
Copy link
Member

Should SHOW DATABASE print nothing for a regular (non-replica) database or something like "Database is not a replica"?

@sim1984
Copy link
Author

sim1984 commented Jan 25, 2023

It should look something like the arguments to gfix -replica.

....
Replica mode: {NONE | READ ONLY | READ WRITE}

@dyemanov
Copy link
Member

Done re. the replica node, in v4 so far (to be frontported into v5 soon). As for SHOW PUBLICATION[S], I'll create a separate ticket.

@aafemt
Copy link
Contributor

aafemt commented Jan 26, 2023

Isn't #7001 enough?

@dyemanov
Copy link
Member

Thanks for reminding.

@pavel-zotov
Copy link

::: qa issues :::

  1. Test name: functional/basic/isql/test_07.py
  2. Currently avaliable only in Firebird-4.x. Waiting for frontport.

@dyemanov
Copy link
Member

Closing this ticket. Publication status will be covered separately by #7001.

@aafemt
Copy link
Contributor

aafemt commented Apr 20, 2023

Aren't replica mode and publication status two separate things? Former is on target side of replication while later is in source.

@dyemanov
Copy link
Member

Yes, but I miss your point. Replica mode is already shown, thus this ticket is closed. #7001 is about publication status, it will be implemented (shown by ISQL) separately. SHOW DATABASE will print either "Replica mode" or "Publication" status strings (or both).

@aafemt
Copy link
Contributor

aafemt commented Apr 20, 2023

Ah, sorry, I misread your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants