From 5efc8274a960a23ad84007c97322f81b7ecb9822 Mon Sep 17 00:00:00 2001 From: zotov Date: Wed, 21 Sep 2022 09:41:54 +0300 Subject: [PATCH] Added/Updated bugs\core_4582_test.py. temporary commented out 'gfix -shut single ...' and bring it online after. See notes. --- tests/bugs/core_4582_test.py | 120 +++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/tests/bugs/core_4582_test.py b/tests/bugs/core_4582_test.py index 100e805b..70a7d987 100644 --- a/tests/bugs/core_4582_test.py +++ b/tests/bugs/core_4582_test.py @@ -3,24 +3,39 @@ """ ID: issue-4898 ISSUE: 4898 -TITLE: Within linger period one can not change some database properties +TITLE: Within LINGER period one can not change some database properties DESCRIPTION: - Confirmed on WI-T3.0.0.31374 Beta 1: running GFIX -buffers N has NO affect if this is done within linger period -NOTES: -[21.12.2021] pcisar - FAILs on v4.0.0.2496 and v3.0.8.33535 as database couldn't be reverted to online state + Test verifies that after set LINGER one may still do following: + * change buffers number in DB header (actual only for CS / SC); + * change FW attribute to 'sync' (by default DB is created with FW = OFF); + * change sweep interval; + * change space usage to '-use ' + * for FB 4.x+: change DB attribute to 'REPLICA READ_WRITE'. + * change DB mode to read_only. + + Confirmed on WI-T3.0.0.31374 Beta 1: running GFIX -buffers N has NO affect if this is done within linger period JIRA: CORE-4582 FBTEST: bugs.core_4582 +NOTES: + [21.12.2021] pcisar + FAILs on v4.0.0.2496 and v3.0.8.33535 as database couldn't be reverted to online state + [21.09.2022] pzotov + It was encountered that if we change DB access to 'shutdown single maintenace' than further 'gifx -online' + will raise message 'database db shutdown', and only 2nd call of gfix will bring DB to online. + Report was sent to FB team, 17.09.2022 23:18, reply from Vlad got: 19.09.2022 13:06. + It was decided to SKIP this action ('gfix -shut single -at NN') until this problem will be resolved. + Checked on Linux and Windows: 3.0.8.33535 (SS/CS), 4.0.1.2692 (SS/CS) """ import pytest from firebird.qa import * -from firebird.driver import DbWriteMode, DbAccessMode, ShutdownMode, ShutdownMethod, \ - SrvStatFlag +from firebird.driver import DbWriteMode, DbAccessMode, ShutdownMode, ShutdownMethod, SrvStatFlag -substitutions = [('^((?!:::MSG:::|buffers|before|after|Attributes).)*$', ''), - ('Page buffers([\t]|[ ])+', 'Page buffers '), - ('Attributes([\t]|[ ])+', 'Attributes '), ('N/A', 'YES')] +substitutions = [ + ('[\t ]+', ' '), + ('^((?!:::MSG:::|buffers|before|after|Sweep|Attributes).)*$', ''), + ('N/A', 'YES') + ] init_script = """ -- Result of this test on WI-T3.0.0.31374 Beta 1: @@ -52,37 +67,33 @@ init_script = """ """ db = db_factory(init=init_script) +#db = db_factory(filename = '#tmp_core_4582_alias', init=init_script) act = python_act('db', substitutions=substitutions) -expected_stdout = """ - :::MSG::: Starting ISQL setting new value for linger... - :::MSG::: linger_time 15 - :::MSG::: ISQL setting new value for linger finished. - :::MSG::: Starting GFIX setting new value for page buffers... - Page buffers 3791 - Attributes single-user maintenance, read only - :::MSG::: GFIX setting new value for page buffers finished. - :::MSG::: Starting ISQL for extract old and new value of page buffers... - GFIX could change buffers ? => YES - :::MSG::: ISQL for extract old and new value of page finished. -""" - -@pytest.mark.skip("FIXME: see notes") @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): - script = """ - insert into log(buf_before) select mon_buffers from sp_get_buff; - commit; - alter database set linger to 15; - commit; - set list on; - select rdb$linger as ":::MSG::: linger_time" from rdb$database; + + if act.is_version('>=4'): + ADDED_REPLICA_ATTR = ", read-write replica" + else: + ADDED_REPLICA_ATTR = '' + + expected_stdout = f""" + Page buffers 3791 + Attributes force write, no reserve, read only{ADDED_REPLICA_ATTR} + Sweep interval: 5678 + GFIX could change buffers ? => YES + """ + + script = """ + insert into log(buf_before) select mon_buffers from sp_get_buff; + commit; + alter database set linger to 15; + commit; """ - print (':::MSG::: Starting ISQL setting new value for linger...') act.isql(switches=[], input=script) - print (':::MSG::: ISQL setting new value for linger finished.') - print (':::MSG::: Starting GFIX setting new value for page buffers...') + #with act.connect_server() as srv: #srv.database.set_default_cache_size(database=act.db.db_path, size=3791) #srv.database.set_write_mode(database=act.db.db_path, mode=DbWriteMode.ASYNC) @@ -96,37 +107,54 @@ def test_1(act: Action, capsys): act.reset() act.gfix(switches=['-buffers', '3791', act.db.dsn]) act.reset() - act.gfix(switches=['-write','async', act.db.dsn]) + act.gfix(switches=['-write','sync', act.db.dsn]) act.reset() + act.gfix(switches=['-housekeeping','5678', act.db.dsn]) + act.reset() + act.gfix(switches=['-use','full', act.db.dsn]) + act.reset() + + if act.is_version('>=4'): + act.gfix(switches=['-replica','read_write', act.db.dsn]) + act.reset() + act.gfix(switches=['-mode','read_only', act.db.dsn]) act.reset() + + + ''' + TEMPORARY COMMENTED, SEE NOTES. DO NOT DELETE THIS TEXT! act.gfix(switches=['-shutdown','single', '-at', '20', act.db.dsn]) act.reset() + ''' act.gstat(switches=['-h']) print(act.stdout) act.reset() + + ''' + TEMPORARY COMMENTED, SEE NOTES. DO NOT DELETE THIS TEXT! # [pcisar] 21.12.2021 # FAILs on v4.0.0.2496 and v3.0.8.33535 as database couldn't be reverted to online # state act.gfix(switches=[act.db.dsn, '-online']) act.reset() + ''' + act.gfix(switches=['-mode','read_write', act.db.dsn]) - print (':::MSG::: GFIX setting new value for page buffers finished.') - print (':::MSG::: Starting ISQL for extract old and new value of page buffers...') script_2 = """ - set list on; - update log set buf_after = (select mon_buffers from sp_get_buff); - commit; - select iif( g.buf_before > 0, - iif( g.buf_before is distinct from g.buf_after, 'YES', 'NO!' ), - 'N/A' - ) as "GFIX could change buffers ? =>" - from log g; + set list on; + update log set buf_after = (select mon_buffers from sp_get_buff); + commit; + select iif( g.buf_before > 0, + iif( g.buf_before is distinct from g.buf_after, 'YES', 'NO!' ), + 'N/A' + ) as "GFIX could change buffers ? =>" + from log g; """ act.reset() act.isql(switches=[], input=script_2) print(act.stdout) - print (':::MSG::: ISQL for extract old and new value of page finished.') + # Check act.expected_stdout = expected_stdout act.stdout = capsys.readouterr().out