Show firebird.log [FOUND messages for interval when this test was running]
Jump to: output_first_mismatch    outcomes_full_history    elapsed_time_chart
Show cross-report outcomes.

Annotation type Annotation details
2 @message
AssertionError: assert   
  - Problem(s) detected, check run_errors_map:
  - repl_tx_not_found_err :
  - UNEXPECTED outcome: pattern 'Error:\s+Transaction\s+\d+\s+(is\s+)?not\s+found' must not occur in log but was ENCOUNTERED there for 21 seconds.
  - replication log diff:
  -    0 ---
  -    1 +++
  -    2 @@ -5423,3 +5423,82 @@
  -    3  deb10build1 (replica) Thu Feb 20 09:24:38 2025
  -    4  	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -    5  	VERBOSE: No new segments found, suspending
  -    6 +
  -    7 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
  -    8 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -    9 +	VERBOSE: Added 2 segment(s) to the queue
  -   10 +
  -   11 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
  -   12 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   13 +	VERBOSE: No new segments found, suspending
  -   14 +
  -   15 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
  -   16 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   17 +	VERBOSE: Added 2 segment(s) to the queue
  -   18 +
  -   19 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
  -   20 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   21 +	VERBOSE: No new segments found, suspending
  -   22 +
  -   23 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
  -   24 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   25 +	VERBOSE: Added 2 segment(s) to the queue
  -   26 +
  -   27 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
  -   28 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   29 +	VERBOSE: No new segments found, suspending
  -   30 +
  -   31 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
  -   32 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   33 +	VERBOSE: Added 2 segment(s) to the queue
  -   34 +
  -   35 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
  -   36 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   37 +	VERBOSE: No new segments found, suspending
  -   38 +
  -   39 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
  -   40 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   41 +	VERBOSE: Added 3 segment(s) to the queue
  -   42 +
  -   43 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
  -   44 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   45 +	ERROR: connection shutdown
  -   46 +	Database is shutdown.
  -   47 +	At segment 6, offset 48
  -   48 +
  -   49 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
  -   50 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   51 +	VERBOSE: Disconnecting and suspending
  -   52 +
  -   53 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   54 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   55 +	VERBOSE: Added 3 segment(s) to the queue
  -   56 +
  -   57 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   58 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   59 +	VERBOSE: Database sequence has been changed to 5, preparing for replication reset
  -   60 +
  -   61 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   62 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   63 +	VERBOSE: Segment 4 (15729380 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
  -   64 +
  -   65 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   66 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   67 +	VERBOSE: Segment 5 (646 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
  -   68 +
  -   69 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   70 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   71 +	VERBOSE: Resetting replication to continue from segment 6 (new OAT: 29 in segment 4)
  -   72 +
  -   73 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   74 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   75 +	VERBOSE: Added 3 segment(s) to the queue
  -   76 +
  -   77 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   78 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   79 +	ERROR: Transaction 29 is not found
  -   80 +	At segment 6, offset 48
  -   81 +
  -   82 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
  -   83 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
  -   84 +	VERBOSE: Disconnecting and suspending
  - ----------------------------------------

LOG DETAILS:

2025-02-20 09:38:15.515
2025-02-20 09:38:15.527 act_db_main = <firebird.qa.plugin.Action object at [hex]>
2025-02-20 09:38:15.536 act_db_repl = <firebird.qa.plugin.Action object at [hex]>
2025-02-20 09:38:15.545 db_nbk0 = PosixPath('/var/tmp/qa_2024/test_12208/gh_8324_tmp.nbk0')
2025-02-20 09:38:15.553 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-02-20 09:38:15.560
2025-02-20 09:38:15.568 @pytest.mark.replication
2025-02-20 09:38:15.576 @pytest.mark.version('>=4.0.6')
2025-02-20 09:38:15.586 def test_1(act_db_main: Action,  act_db_repl: Action, db_nbk0: Path, capsys):
2025-02-20 09:38:15.595
2025-02-20 09:38:15.605 FLD_WIDTH = 500
2025-02-20 09:38:15.614 ADD_ROWS_INIT = 100
2025-02-20 09:38:15.624 ADD_ROWS_IN_OAT = 30000
2025-02-20 09:38:15.635 TEST2_VALUE = -2147483648
2025-02-20 09:38:15.644
2025-02-20 09:38:15.652 # Map for storing mnemonas and details for every FAILED step:
2025-02-20 09:38:15.660 run_errors_map = {}
2025-02-20 09:38:15.667
2025-02-20 09:38:15.675 # Obtain full path + filename for DB_MAIN and DB_REPL aliases.
2025-02-20 09:38:15.682 # NOTE: we must NOT use 'a.db.db_path' for ALIASED databases!
2025-02-20 09:38:15.691 # It will return '.' rather than full path+filename.
2025-02-20 09:38:15.700 # Use only con.info.name for that!
2025-02-20 09:38:15.711 #
2025-02-20 09:38:15.725 db_info = {}
2025-02-20 09:38:15.738 for a in (act_db_main, act_db_repl):
2025-02-20 09:38:15.752 with a.db.connect() as con:
2025-02-20 09:38:15.762 db_info[a,  'db_full_path'] = con.info.name
2025-02-20 09:38:15.771
2025-02-20 09:38:15.781 sql_init = f"""
2025-02-20 09:38:15.795 set bail on;
2025-02-20 09:38:15.804 set wng off;
2025-02-20 09:38:15.813 recreate table test (
2025-02-20 09:38:15.826 id int generated by default as identity constraint test_pk primary key
2025-02-20 09:38:15.837 ,dts timestamp default 'now'
2025-02-20 09:38:15.845 ,trn bigint default current_transaction
2025-02-20 09:38:15.853 ,s varchar({FLD_WIDTH}) unique using index test_f01_unq
2025-02-20 09:38:15.864 );
2025-02-20 09:38:15.876
2025-02-20 09:38:15.886 recreate table test2 (
2025-02-20 09:38:15.901 id int generated by default as identity constraint test2_pk primary key
2025-02-20 09:38:15.912 ,dts timestamp default 'now'
2025-02-20 09:38:15.925 ,trn bigint default current_transaction
2025-02-20 09:38:15.936 ,s varchar({FLD_WIDTH}) unique using index test2_f01_unq
2025-02-20 09:38:15.949 );
2025-02-20 09:38:15.959 commit;
2025-02-20 09:38:15.968
2025-02-20 09:38:15.977 insert into test(s) select lpad( '', {FLD_WIDTH}, uuid_to_char(gen_uuid()) ) from rdb$types rows {ADD_ROWS_INIT};
2025-02-20 09:38:15.984 commit;
2025-02-20 09:38:15.999
2025-02-20 09:38:16.009 recreate table t_completed(id int primary key);
2025-02-20 09:38:16.020 commit;
2025-02-20 09:38:16.033 """
2025-02-20 09:38:16.044 act_db_main.isql(switches=['-q'], input = sql_init, combine_output = True)
2025-02-20 09:38:16.057 run_errors_map['out_prep_ddl'] = act_db_main.clean_stdout
2025-02-20 09:38:16.071 act_db_main.reset()
2025-02-20 09:38:16.080
2025-02-20 09:38:16.087 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.099 # Some problem raised during init_sql execution
2025-02-20 09:38:16.113 pass
2025-02-20 09:38:16.121 else:
2025-02-20 09:38:16.129 # Query to be used for check that all DB objects present in replica (after last DML statement completed on master DB):
2025-02-20 09:38:16.136 ddl_ready_query = "select 1 from rdb$relations where rdb$relation_name = upper('t_completed')"
2025-02-20 09:38:16.143 #####################################################################
2025-02-20 09:38:16.151 ###  WAIT UNTIL REPLICA GET SEGMENT(S) WITH INITIAL DDL AND DATA  ###
2025-02-20 09:38:16.160 #####################################################################
2025-02-20 09:38:16.167 watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query)
2025-02-20 09:38:16.175
2025-02-20 09:38:16.184 # Must be EMPTY:
2025-02-20 09:38:16.195 run_errors_map['out_repl_ddl'] = capsys.readouterr().out
2025-02-20 09:38:16.204
2025-02-20 09:38:16.212 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.219 # Some problem raised with delivering DDL changes to replica
2025-02-20 09:38:16.234 pass
2025-02-20 09:38:16.244 else:
2025-02-20 09:38:16.252
2025-02-20 09:38:16.258 with act_db_main.db.connect() as con:
2025-02-20 09:38:16.265 preserved_segment_no = -1
2025-02-20 09:38:16.273
2025-02-20 09:38:16.281 tp_oat = tpb(isolation = Isolation.SNAPSHOT, lock_timeout = 0)
2025-02-20 09:38:16.288 tx_oat = con.transaction_manager(tp_oat)
2025-02-20 09:38:16.295 cur_oat = tx_oat.cursor()
2025-02-20 09:38:16.303
2025-02-20 09:38:16.311 tx_oat.begin()
2025-02-20 09:38:16.320 replold_lines = get_repl_log(act_db_main)
2025-02-20 09:38:16.332
2025-02-20 09:38:16.340 try:
2025-02-20 09:38:16.347 cur_oat.execute(f"insert /* trace_tag OAT */ into test(s) select lpad('', {FLD_WIDTH}, uuid_to_char(gen_uuid())) from rdb$types,rdb$types rows {ADD_ROWS_IN_OAT}")
2025-02-20 09:38:16.355 cur_oat.execute('select max(id) from test')
2025-02-20 09:38:16.363 cur_oat.fetchone()
2025-02-20 09:38:16.371 except DatabaseError as e:
2025-02-20 09:38:16.379 run_errors_map['main_oat_init_err'] = e.__str__()
2025-02-20 09:38:16.388
2025-02-20 09:38:16.397 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.406 # Some problem was in just executed OAT-statement
2025-02-20 09:38:16.413 pass
2025-02-20 09:38:16.424 else:
2025-02-20 09:38:16.434 ##############################################################
2025-02-20 09:38:16.443 ###  CHECK REPL.LOG: WAITING FOR "PRESERVING OAT" MESSAGE  ###
2025-02-20 09:38:16.458 ##############################################################
2025-02-20 09:38:16.467 # VERBOSE: Segment 2 (11534562 bytes) is replicated in 0.934s, preserving (OAT: 10 in segment 2)
2025-02-20 09:38:16.474 pattern_to_check = re.compile( r'preserving \(oat:\s+\d+\s+in\s+segment\s+\d+', re.IGNORECASE )
2025-02-20 09:38:16.484 run_errors_map['repl_preserve_oat_err'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG)
2025-02-20 09:38:16.497
2025-02-20 09:38:16.513 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.529 # Timeout expired: message "Segment ... preserving (OAT: ... in segment ...)" did not appeared
2025-02-20 09:38:16.539 # in replication log for <MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG> seconds.
2025-02-20 09:38:16.549 pass
2025-02-20 09:38:16.558 else:
2025-02-20 09:38:16.567
2025-02-20 09:38:16.575 ###############################################
2025-02-20 09:38:16.587 ###  MASTER: RUN DML BEFORE 'NBACKUP -B 0'  ###
2025-02-20 09:38:16.601 ###############################################
2025-02-20 09:38:16.611 # tp_wrk = tpb(isolation = Isolation.READ_COMMITTED_READ_CONSISTENCY, lock_timeout = 3) # ?!?! check trace  !!!
2025-02-20 09:38:16.620 tp_bef = tpb(isolation = Isolation.READ_COMMITTED, lock_timeout = 3)
2025-02-20 09:38:16.627 tx_bef = con.transaction_manager(tp_bef)
2025-02-20 09:38:16.636 cur_bef = tx_bef.cursor()
2025-02-20 09:38:16.643 try:
2025-02-20 09:38:16.651 tx_bef.begin()
2025-02-20 09:38:16.658 cur_bef.execute(f"insert /* trace_tag before creating nbk-0 */ into test2(id) values(?) returning rdb$get_context('SYSTEM', 'REPLICATION_SEQUENCE')", (TEST2_VALUE,))
2025-02-20 09:38:16.674
2025-02-20 09:38:16.684 # If returned value of rdb$get_context('SYSTEM', 'REPLICATION_SEQUENCE') is <N> then
2025-02-20 09:38:16.694 # message in replication log contains this number PLUS 1, e.g. (for REPLICATION_SEQUENCE = 1):
2025-02-20 09:38:16.702 # "Segment 2 (11534562 bytes) is replicated in 0.934s, preserving (OAT: 10 in segment 2)"
2025-02-20 09:38:16.711 # We store this result in order to check further content of replication log that this
2025-02-20 09:38:16.719 # segment was eventuially deleted (this will mean SUCCESSFUL finish of test):
2025-02-20 09:38:16.726 #
2025-02-20 09:38:16.734 preserved_segment_no = int(cur_bef.fetchone()[0]) + 1
2025-02-20 09:38:16.746 tx_bef.commit()
2025-02-20 09:38:16.759 except DatabaseError as e:
2025-02-20 09:38:16.768 run_errors_map['main_dml_afte_nbk0_err'] = e.__str__()
2025-02-20 09:38:16.781
2025-02-20 09:38:16.790 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.798 # Some problem was in just executed statement
2025-02-20 09:38:16.809 pass
2025-02-20 09:38:16.819 else:
2025-02-20 09:38:16.831 ##############################################
2025-02-20 09:38:16.843 ###  WAIT UNTIL REPLICA DB BECOMES ACTUAL  ###
2025-02-20 09:38:16.852 ##############################################
2025-02-20 09:38:16.861 # ( a: Action, max_allowed_time_for_wait, ddl_ready_query = '', isql_check_script = '', replica_expected_out = ''):
2025-02-20 09:38:16.869 chk_bef_sql = f'set heading off;select count(*) from test2 where id = {TEST2_VALUE};'
2025-02-20 09:38:16.877 watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query = '', isql_check_script = chk_bef_sql, replica_expected_out = '1' )
2025-02-20 09:38:16.884
2025-02-20 09:38:16.891 # Must be EMPTY:
2025-02-20 09:38:16.898 run_errors_map['repl_chk_addi_data_err'] = capsys.readouterr().out
2025-02-20 09:38:16.904
2025-02-20 09:38:16.911 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:16.924 # Timeout expired: expected data did not appear in replica DB for <MAX_TIME_FOR_WAIT_DATA_IN_REPLICA> seconds.
2025-02-20 09:38:16.933 pass
2025-02-20 09:38:16.940 else:
2025-02-20 09:38:16.948 ################################################
2025-02-20 09:38:16.955 ###  REPLICA: CHANGE STATE TO FULL SHUTDOWN  ###
2025-02-20 09:38:16.966 ################################################
2025-02-20 09:38:16.975 act_db_repl.gfix(switches=['-shut', 'full', '-force', '0', act_db_repl.db.dsn], io_enc = locale.getpreferredencoding(), combine_output = True )
2025-02-20 09:38:16.984 run_errors_map['repl_full_shutdown_err'] = act_db_repl.stdout
2025-02-20 09:38:16.993 act_db_repl.reset()
2025-02-20 09:38:17.003
2025-02-20 09:38:17.014 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.024 pass
2025-02-20 09:38:17.036 else:
2025-02-20 09:38:17.045 ##########################################
2025-02-20 09:38:17.054 ###  M A S T E R:    M A K E   N B K 0  ##
2025-02-20 09:38:17.060 ##########################################
2025-02-20 09:38:17.066 # DO NOT use 'combine_output = True' here: nbackup produces non-empty output when successfully completes.
2025-02-20 09:38:17.072 act_db_main.nbackup( switches = ['-b', '0', act_db_main.db.dsn, db_nbk0], io_enc = locale.getpreferredencoding(), combine_output = False )
2025-02-20 09:38:17.079 run_errors_map['main_create_nbk0_err'] = act_db_main.stderr
2025-02-20 09:38:17.085 act_db_main.reset()
2025-02-20 09:38:17.092
2025-02-20 09:38:17.100 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.108 # Some errors occurres during 'nbackup -b 0 db_main_alias ...'
2025-02-20 09:38:17.114 pass
2025-02-20 09:38:17.128 else:
2025-02-20 09:38:17.138 ##############################################################################################
2025-02-20 09:38:17.145 ###   NBK0: FIXUP, SET AS REPLICA, CHANGE STATE TO FULL SHUTDOWN,  MOVE TO OLD  'DB_REPL'  ###
2025-02-20 09:38:17.152 ##############################################################################################
2025-02-20 09:38:17.162 try:
2025-02-20 09:38:17.171 act_db_repl.nbackup(switches = ['-SEQ', '-F', str(db_nbk0)], combine_output = True, io_enc = locale.getpreferredencoding())
2025-02-20 09:38:17.182 # act_db_main.svcmgr(switches=['action_nfix', 'dbname', str(db_nbk0)], io_enc = locale.getpreferredencoding())
2025-02-20 09:38:17.192 with act_db_main.connect_server() as srv:
2025-02-20 09:38:17.206 #srv.database.nfix_database(database = db_nbk0) --> "Internal error when using clumplet API: attempt to store data in dataless clumplet" // see also: core_5085_test.py
2025-02-20 09:38:17.218 srv.database.set_replica_mode(database = db_nbk0, mode = ReplicaMode.READ_ONLY)
2025-02-20 09:38:17.225 srv.database.shutdown(database = db_nbk0, mode = ShutdownMode.FULL, method = ShutdownMethod.FORCED, timeout = 0)
2025-02-20 09:38:17.232 except DatabaseError as e:
2025-02-20 09:38:17.241 run_errors_map['nbk0_make_new_replica_err'] = e.__str__()
2025-02-20 09:38:17.253
2025-02-20 09:38:17.262 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.271 pass
2025-02-20 09:38:17.279 else:
2025-02-20 09:38:17.287
2025-02-20 09:38:17.293 ##################################
2025-02-20 09:38:17.299 ###   OVERWRITE  OLD  REPLICA  ###
2025-02-20 09:38:17.304 ##################################
2025-02-20 09:38:17.310 shutil.move(db_nbk0, db_info[act_db_repl,'db_full_path'])
2025-02-20 09:38:17.321
2025-02-20 09:38:17.331 ##################################
2025-02-20 09:38:17.339 ###   REPLICA:  BRING  ONLINE  ###
2025-02-20 09:38:17.347 ##################################
2025-02-20 09:38:17.357 act_db_repl.gfix(switches=['-online', act_db_repl.db.dsn], io_enc = locale.getpreferredencoding(), combine_output = True )
2025-02-20 09:38:17.365 run_errors_map['repl_bring_online_err']  = act_db_repl.stdout
2025-02-20 09:38:17.372 act_db_repl.reset()
2025-02-20 09:38:17.378
2025-02-20 09:38:17.384 replold_lines = get_repl_log(act_db_main)
2025-02-20 09:38:17.389 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.396 pass
2025-02-20 09:38:17.402 else:
2025-02-20 09:38:17.408 ##############################################
2025-02-20 09:38:17.415 ###  MASTER: FINAL ACTION WITHIN TX = OAT  ###
2025-02-20 09:38:17.423 ##############################################
2025-02-20 09:38:17.430 try:
2025-02-20 09:38:17.441 tx_oat.commit()
2025-02-20 09:38:17.451 except DatabaseError as e:
2025-02-20 09:38:17.461 run_errors_map['main_oat_fini_err'] = e.__str__()
2025-02-20 09:38:17.468
2025-02-20 09:38:17.475 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.483 pass
2025-02-20 09:38:17.491 else:
2025-02-20 09:38:17.497
2025-02-20 09:38:17.508 ############################################################################
2025-02-20 09:38:17.517 ###  CHECK REPL.LOG: WAITING FOR "Transaction <N> is not found" MESSAGE  ###
2025-02-20 09:38:17.525 ############################################################################
2025-02-20 09:38:17.539 # Before fix: "ERROR: Transaction 13 is not found" appeared in the repl log at thios point.
2025-02-20 09:38:17.554 pattern_to_check = re.compile( r'Error:\s+Transaction\s+\d+\s+(is\s+)?not\s+found', re.IGNORECASE )
2025-02-20 09:38:17.567 run_errors_map['repl_tx_not_found_err'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG, consider_found_as_unexpected = True)
2025-02-20 09:38:17.576
2025-02-20 09:38:17.585 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.592 pass
2025-02-20 09:38:17.599 else:
2025-02-20 09:38:17.605 ##############################################
2025-02-20 09:38:17.612 ###  WAIT UNTIL REPLICA DB BECOMES ACTUAL  ###
2025-02-20 09:38:17.618 ##############################################
2025-02-20 09:38:17.625 # ( a: Action, max_allowed_time_for_wait, ddl_ready_query = '', isql_check_script = '', replica_expected_out = ''):
2025-02-20 09:38:17.635 chk_oat_sql = 'set heading off;select max(id) from test;'
2025-02-20 09:38:17.644 watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query = '', isql_check_script = chk_oat_sql, replica_expected_out = str(ADD_ROWS_INIT+ADD_ROWS_IN_OAT) )
2025-02-20 09:38:17.653 # Must be EMPTY:
2025-02-20 09:38:17.662 run_errors_map['repl_chk_fini_err'] = capsys.readouterr().out
2025-02-20 09:38:17.670
2025-02-20 09:38:17.680 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.693 pass
2025-02-20 09:38:17.702 else:
2025-02-20 09:38:17.710 #######################################################################################
2025-02-20 09:38:17.717 ###  CHECK REPL.LOG: WAITING FOR "DELETING SEGMENT {} AS NO LONGER NEEDED" MESSAGE  ###
2025-02-20 09:38:17.724 #######################################################################################
2025-02-20 09:38:17.731 # VERBOSE: Deleting segment 2 as no longer needed
2025-02-20 09:38:17.737 # NB: before fix message was: "VERBOSE: Deleting segment 2 due to fast forward"
2025-02-20 09:38:17.744 pattern_to_check = re.compile( r'VERBOSE:\s+Deleting\s+segment\s+%d\s+as\s+no\s+longer\s+needed' % preserved_segment_no, re.IGNORECASE )
2025-02-20 09:38:17.751 run_errors_map['repl_deleted_oat_segm'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG)
2025-02-20 09:38:17.760
2025-02-20 09:38:17.771 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.779 # We had a problem in some of previous steps.
2025-02-20 09:38:17.787 # First, we have to RECREATE both master and slave databases
2025-02-20 09:38:17.794 # (otherwise further execution of this test or other replication-related tests most likely will fail):
2025-02-20 09:38:17.803 run_errors_map['out_reset'] = reset_replication(act_db_main, act_db_repl, db_info[act_db_main,'db_full_path'], db_info[act_db_repl,'db_full_path'])
2025-02-20 09:38:17.816 else:
2025-02-20 09:38:17.828 drop_db_objects(act_db_main, act_db_repl, capsys)
2025-02-20 09:38:17.838 # Must be EMPTY:
2025-02-20 09:38:17.847 run_errors_map['out_drop'] = capsys.readouterr().out
2025-02-20 09:38:17.855
2025-02-20 09:38:17.862 if max(v.strip() for v in run_errors_map.values()):
2025-02-20 09:38:17.871 print(f'Problem(s) detected, check run_errors_map:')
2025-02-20 09:38:17.883 for k,v in run_errors_map.items():
2025-02-20 09:38:17.892 if v.strip():
2025-02-20 09:38:17.900 print(k,':')
2025-02-20 09:38:17.906 print(v.strip())
2025-02-20 09:38:17.913 print('-' * 40)
2025-02-20 09:38:17.919
2025-02-20 09:38:17.927 >       assert '' == capsys.readouterr().out
2025-02-20 09:38:17.938 E       AssertionError: assert
2025-02-20 09:38:17.946 E         - Problem(s) detected, check run_errors_map:
2025-02-20 09:38:17.954 E         - repl_tx_not_found_err :
2025-02-20 09:38:17.964 E         - UNEXPECTED outcome: pattern 'Error:\s+Transaction\s+\d+\s+(is\s+)?not\s+found' must not occur in log but was ENCOUNTERED there for 21 seconds.
2025-02-20 09:38:17.973 E         - replication log diff:
2025-02-20 09:38:17.979 E         -    0 ---
2025-02-20 09:38:17.986 E         -    1 +++
2025-02-20 09:38:17.995 E         -    2 @@ -5423,3 +5423,82 @@
2025-02-20 09:38:18.007 E         -    3  deb10build1 (replica) Thu Feb 20 09:24:38 2025
2025-02-20 09:38:18.020 E         -    4  	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.034 E         -    5  	VERBOSE: No new segments found, suspending
2025-02-20 09:38:18.044 E         -    6 +
2025-02-20 09:38:18.056 E         -    7 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
2025-02-20 09:38:18.069 E         -    8 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.080 E         -    9 +	VERBOSE: Added 2 segment(s) to the queue
2025-02-20 09:38:18.089 E         -   10 +
2025-02-20 09:38:18.098 E         -   11 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
2025-02-20 09:38:18.105 E         -   12 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.111 E         -   13 +	VERBOSE: No new segments found, suspending
2025-02-20 09:38:18.118 E         -   14 +
2025-02-20 09:38:18.125 E         -   15 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
2025-02-20 09:38:18.131 E         -   16 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.137 E         -   17 +	VERBOSE: Added 2 segment(s) to the queue
2025-02-20 09:38:18.144 E         -   18 +
2025-02-20 09:38:18.152 E         -   19 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
2025-02-20 09:38:18.159 E         -   20 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.166 E         -   21 +	VERBOSE: No new segments found, suspending
2025-02-20 09:38:18.172 E         -   22 +
2025-02-20 09:38:18.185 E         -   23 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
2025-02-20 09:38:18.198 E         -   24 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.212 E         -   25 +	VERBOSE: Added 2 segment(s) to the queue
2025-02-20 09:38:18.226 E         -   26 +
2025-02-20 09:38:18.235 E         -   27 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
2025-02-20 09:38:18.244 E         -   28 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.253 E         -   29 +	VERBOSE: No new segments found, suspending
2025-02-20 09:38:18.261 E         -   30 +
2025-02-20 09:38:18.268 E         -   31 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
2025-02-20 09:38:18.273 E         -   32 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.279 E         -   33 +	VERBOSE: Added 2 segment(s) to the queue
2025-02-20 09:38:18.284 E         -   34 +
2025-02-20 09:38:18.290 E         -   35 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
2025-02-20 09:38:18.297 E         -   36 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.303 E         -   37 +	VERBOSE: No new segments found, suspending
2025-02-20 09:38:18.308 E         -   38 +
2025-02-20 09:38:18.314 E         -   39 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
2025-02-20 09:38:18.321 E         -   40 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.327 E         -   41 +	VERBOSE: Added 3 segment(s) to the queue
2025-02-20 09:38:18.334 E         -   42 +
2025-02-20 09:38:18.342 E         -   43 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
2025-02-20 09:38:18.352 E         -   44 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.358 E         -   45 +	ERROR: connection shutdown
2025-02-20 09:38:18.364 E         -   46 +	Database is shutdown.
2025-02-20 09:38:18.372 E         -   47 +	At segment 6, offset 48
2025-02-20 09:38:18.383 E         -   48 +
2025-02-20 09:38:18.391 E         -   49 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
2025-02-20 09:38:18.400 E         -   50 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.406 E         -   51 +	VERBOSE: Disconnecting and suspending
2025-02-20 09:38:18.418 E         -   52 +
2025-02-20 09:38:18.431 E         -   53 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.442 E         -   54 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.449 E         -   55 +	VERBOSE: Added 3 segment(s) to the queue
2025-02-20 09:38:18.456 E         -   56 +
2025-02-20 09:38:18.463 E         -   57 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.470 E         -   58 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.477 E         -   59 +	VERBOSE: Database sequence has been changed to 5, preparing for replication reset
2025-02-20 09:38:18.483 E         -   60 +
2025-02-20 09:38:18.489 E         -   61 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.499 E         -   62 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.508 E         -   63 +	VERBOSE: Segment 4 (15729380 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
2025-02-20 09:38:18.515 E         -   64 +
2025-02-20 09:38:18.522 E         -   65 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.530 E         -   66 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.537 E         -   67 +	VERBOSE: Segment 5 (646 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
2025-02-20 09:38:18.548 E         -   68 +
2025-02-20 09:38:18.560 E         -   69 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.571 E         -   70 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.580 E         -   71 +	VERBOSE: Resetting replication to continue from segment 6 (new OAT: 29 in segment 4)
2025-02-20 09:38:18.587 E         -   72 +
2025-02-20 09:38:18.602 E         -   73 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.612 E         -   74 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.620 E         -   75 +	VERBOSE: Added 3 segment(s) to the queue
2025-02-20 09:38:18.628 E         -   76 +
2025-02-20 09:38:18.634 E         -   77 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.641 E         -   78 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.648 E         -   79 +	ERROR: Transaction 29 is not found
2025-02-20 09:38:18.654 E         -   80 +	At segment 6, offset 48
2025-02-20 09:38:18.662 E         -   81 +
2025-02-20 09:38:18.670 E         -   82 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
2025-02-20 09:38:18.677 E         -   83 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
2025-02-20 09:38:18.684 E         -   84 +	VERBOSE: Disconnecting and suspending
2025-02-20 09:38:18.691 E         - ----------------------------------------
2025-02-20 09:38:18.698
2025-02-20 09:38:18.704 tests/functional/replication/test_make_async_reinit_reliable.py:689: AssertionError
3 #text
act_db_main = <firebird.qa.plugin.Action pytest object at [hex]>
act_db_repl = <firebird.qa.plugin.Action pytest object at [hex]>
db_nbk0 = PosixPath('/var/tmp/qa_2024/test_12208/gh_8324_tmp.nbk0')
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>

    @pytest.mark.replication
    @pytest.mark.version('>=4.0.6')
    def test_1(act_db_main: Action,  act_db_repl: Action, db_nbk0: Path, capsys):
    
        FLD_WIDTH = 500
        ADD_ROWS_INIT = 100
        ADD_ROWS_IN_OAT = 30000
        TEST2_VALUE = -2147483648
    
        # Map for storing mnemonas and details for every FAILED step:
        run_errors_map = {}
    
        # Obtain full path + filename for DB_MAIN and DB_REPL aliases.
        # NOTE: we must NOT use 'a.db.db_path' for ALIASED databases!
        # It will return '.' rather than full path+filename.
        # Use only con.info.name for that!
        #
        db_info = {}
        for a in (act_db_main, act_db_repl):
            with a.db.connect() as con:
                db_info[a,  'db_full_path'] = con.info.name
    
        sql_init = f"""
            set bail on;
            set wng off;
            recreate table test (
                id int generated by default as identity constraint test_pk primary key
                ,dts timestamp default 'now'
                ,trn bigint default current_transaction
                ,s varchar({FLD_WIDTH}) unique using index test_f01_unq
            );
    
            recreate table test2 (
                id int generated by default as identity constraint test2_pk primary key
                ,dts timestamp default 'now'
                ,trn bigint default current_transaction
                ,s varchar({FLD_WIDTH}) unique using index test2_f01_unq
            );
            commit;
    
            insert into test(s) select lpad( '', {FLD_WIDTH}, uuid_to_char(gen_uuid()) ) from rdb$types rows {ADD_ROWS_INIT};
            commit;
    
            recreate table t_completed(id int primary key);
            commit;
        """
        act_db_main.isql(switches=['-q'], input = sql_init, combine_output = True)
        run_errors_map['out_prep_ddl'] = act_db_main.clean_stdout
        act_db_main.reset()
    
        if max(v.strip() for v in run_errors_map.values()):
            # Some problem raised during init_sql execution
            pass
        else:
            # Query to be used for check that all DB objects present in replica (after last DML statement completed on master DB):
            ddl_ready_query = "select 1 from rdb$relations where rdb$relation_name = upper('t_completed')"
            #####################################################################
            ###  WAIT UNTIL REPLICA GET SEGMENT(S) WITH INITIAL DDL AND DATA  ###
            #####################################################################
            watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query)
    
            # Must be EMPTY:
            run_errors_map['out_repl_ddl'] = capsys.readouterr().out
    
        if max(v.strip() for v in run_errors_map.values()):
            # Some problem raised with delivering DDL changes to replica
            pass
        else:
    
            with act_db_main.db.connect() as con:
                preserved_segment_no = -1
    
                tp_oat = tpb(isolation = Isolation.SNAPSHOT, lock_timeout = 0)
                tx_oat = con.transaction_manager(tp_oat)
                cur_oat = tx_oat.cursor()
    
                tx_oat.begin()
                replold_lines = get_repl_log(act_db_main)
    
                try:
                    cur_oat.execute(f"insert /* trace_tag OAT */ into test(s) select lpad('', {FLD_WIDTH}, uuid_to_char(gen_uuid())) from rdb$types,rdb$types rows {ADD_ROWS_IN_OAT}")
                    cur_oat.execute('select max(id) from test')
                    cur_oat.fetchone()
                except DatabaseError as e:
                    run_errors_map['main_oat_init_err'] = e.__str__()
    
                if max(v.strip() for v in run_errors_map.values()):
                    # Some problem was in just executed OAT-statement
                    pass
                else:
                    ##############################################################
                    ###  CHECK REPL.LOG: WAITING FOR "PRESERVING OAT" MESSAGE  ###
                    ##############################################################
                    # VERBOSE: Segment 2 (11534562 bytes) is replicated in 0.934s, preserving (OAT: 10 in segment 2)
                    pattern_to_check = re.compile( r'preserving \(oat:\s+\d+\s+in\s+segment\s+\d+', re.IGNORECASE )
                    run_errors_map['repl_preserve_oat_err'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG)
    
                if max(v.strip() for v in run_errors_map.values()):
                    # Timeout expired: message "Segment ... preserving (OAT: ... in segment ...)" did not appeared
                    # in replication log for <MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG> seconds.
                    pass
                else:
    
                    ###############################################
                    ###  MASTER: RUN DML BEFORE 'NBACKUP -B 0'  ###
                    ###############################################
                    # tp_wrk = tpb(isolation = Isolation.READ_COMMITTED_READ_CONSISTENCY, lock_timeout = 3) # ?!?! check trace  !!!
                    tp_bef = tpb(isolation = Isolation.READ_COMMITTED, lock_timeout = 3)
                    tx_bef = con.transaction_manager(tp_bef)
                    cur_bef = tx_bef.cursor()
                    try:
                        tx_bef.begin()
                        cur_bef.execute(f"insert /* trace_tag before creating nbk-0 */ into test2(id) values(?) returning rdb$get_context('SYSTEM', 'REPLICATION_SEQUENCE')", (TEST2_VALUE,))
    
                        # If returned value of rdb$get_context('SYSTEM', 'REPLICATION_SEQUENCE') is <N> then
                        # message in replication log contains this number PLUS 1, e.g. (for REPLICATION_SEQUENCE = 1):
                        # "Segment 2 (11534562 bytes) is replicated in 0.934s, preserving (OAT: 10 in segment 2)"
                        # We store this result in order to check further content of replication log that this
                        # segment was eventuially deleted (this will mean SUCCESSFUL finish of test):
                        #
                        preserved_segment_no = int(cur_bef.fetchone()[0]) + 1
                        tx_bef.commit()
                    except DatabaseError as e:
                        run_errors_map['main_dml_afte_nbk0_err'] = e.__str__()
    
                if max(v.strip() for v in run_errors_map.values()):
                    # Some problem was in just executed statement
                    pass
                else:
                    ##############################################
                    ###  WAIT UNTIL REPLICA DB BECOMES ACTUAL  ###
                    ##############################################
                    # ( a: Action, max_allowed_time_for_wait, ddl_ready_query = '', isql_check_script = '', replica_expected_out = ''):
                    chk_bef_sql = f'set heading off;select count(*) from test2 where id = {TEST2_VALUE};'
                    watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query = '', isql_check_script = chk_bef_sql, replica_expected_out = '1' )
    
                    # Must be EMPTY:
                    run_errors_map['repl_chk_addi_data_err'] = capsys.readouterr().out
    
                if max(v.strip() for v in run_errors_map.values()):
                    # Timeout expired: expected data did not appear in replica DB for <MAX_TIME_FOR_WAIT_DATA_IN_REPLICA> seconds.
                    pass
                else:
                    ################################################
                    ###  REPLICA: CHANGE STATE TO FULL SHUTDOWN  ###
                    ################################################
                    act_db_repl.gfix(switches=['-shut', 'full', '-force', '0', act_db_repl.db.dsn], io_enc = locale.getpreferredencoding(), combine_output = True )
                    run_errors_map['repl_full_shutdown_err'] = act_db_repl.stdout
                    act_db_repl.reset()
    
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
                    ##########################################
                    ###  M A S T E R:    M A K E   N B K 0  ##
                    ##########################################
                    # DO NOT use 'combine_output = True' here: nbackup produces non-empty output when successfully completes.
                    act_db_main.nbackup( switches = ['-b', '0', act_db_main.db.dsn, db_nbk0], io_enc = locale.getpreferredencoding(), combine_output = False )
                    run_errors_map['main_create_nbk0_err'] = act_db_main.stderr
                    act_db_main.reset()
    
                if max(v.strip() for v in run_errors_map.values()):
                    # Some errors occurres during 'nbackup -b 0 db_main_alias ...'
                    pass
                else:
                    ##############################################################################################
                    ###   NBK0: FIXUP, SET AS REPLICA, CHANGE STATE TO FULL SHUTDOWN,  MOVE TO OLD  'DB_REPL'  ###
                    ##############################################################################################
                    try:
                        act_db_repl.nbackup(switches = ['-SEQ', '-F', str(db_nbk0)], combine_output = True, io_enc = locale.getpreferredencoding())
                        # act_db_main.svcmgr(switches=['action_nfix', 'dbname', str(db_nbk0)], io_enc = locale.getpreferredencoding())
                        with act_db_main.connect_server() as srv:
                            #srv.database.nfix_database(database = db_nbk0) --> "Internal error when using clumplet API: attempt to store data in dataless clumplet" // see also: core_5085_test.py
                            srv.database.set_replica_mode(database = db_nbk0, mode = ReplicaMode.READ_ONLY)
                            srv.database.shutdown(database = db_nbk0, mode = ShutdownMode.FULL, method = ShutdownMethod.FORCED, timeout = 0)
                    except DatabaseError as e:
                        run_errors_map['nbk0_make_new_replica_err'] = e.__str__()
    
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
    
                    ##################################
                    ###   OVERWRITE  OLD  REPLICA  ###
                    ##################################
                    shutil.move(db_nbk0, db_info[act_db_repl,'db_full_path'])
    
                    ##################################
                    ###   REPLICA:  BRING  ONLINE  ###
                    ##################################
                    act_db_repl.gfix(switches=['-online', act_db_repl.db.dsn], io_enc = locale.getpreferredencoding(), combine_output = True )
                    run_errors_map['repl_bring_online_err']  = act_db_repl.stdout
                    act_db_repl.reset()
    
                replold_lines = get_repl_log(act_db_main)
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
                    ##############################################
                    ###  MASTER: FINAL ACTION WITHIN TX = OAT  ###
                    ##############################################
                    try:
                        tx_oat.commit()
                    except DatabaseError as e:
                        run_errors_map['main_oat_fini_err'] = e.__str__()
    
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
    
                    ############################################################################
                    ###  CHECK REPL.LOG: WAITING FOR "Transaction <N> is not found" MESSAGE  ###
                    ############################################################################
                    # Before fix: "ERROR: Transaction 13 is not found" appeared in the repl log at thios point.
                    pattern_to_check = re.compile( r'Error:\s+Transaction\s+\d+\s+(is\s+)?not\s+found', re.IGNORECASE )
                    run_errors_map['repl_tx_not_found_err'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG, consider_found_as_unexpected = True)
    
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
                    ##############################################
                    ###  WAIT UNTIL REPLICA DB BECOMES ACTUAL  ###
                    ##############################################
                    # ( a: Action, max_allowed_time_for_wait, ddl_ready_query = '', isql_check_script = '', replica_expected_out = ''):
                    chk_oat_sql = 'set heading off;select max(id) from test;'
                    watch_replica( act_db_repl, MAX_TIME_FOR_WAIT_DATA_IN_REPLICA, ddl_ready_query = '', isql_check_script = chk_oat_sql, replica_expected_out = str(ADD_ROWS_INIT+ADD_ROWS_IN_OAT) )
                    # Must be EMPTY:
                    run_errors_map['repl_chk_fini_err'] = capsys.readouterr().out
    
                if max(v.strip() for v in run_errors_map.values()):
                    pass
                else:
                    #######################################################################################
                    ###  CHECK REPL.LOG: WAITING FOR "DELETING SEGMENT {} AS NO LONGER NEEDED" MESSAGE  ###
                    #######################################################################################
                    # VERBOSE: Deleting segment 2 as no longer needed
                    # NB: before fix message was: "VERBOSE: Deleting segment 2 due to fast forward"
                    pattern_to_check = re.compile( r'VERBOSE:\s+Deleting\s+segment\s+%d\s+as\s+no\s+longer\s+needed' % preserved_segment_no, re.IGNORECASE )
                    run_errors_map['repl_deleted_oat_segm'] = watch_repl_log_pattern( act_db_main, pattern_to_check, replold_lines, MAX_TIME_FOR_WAIT_SEGMENT_IN_LOG)
    
        if max(v.strip() for v in run_errors_map.values()):
            # We had a problem in some of previous steps.
            # First, we have to RECREATE both master and slave databases
            # (otherwise further execution of this test or other replication-related tests most likely will fail):
            run_errors_map['out_reset'] = reset_replication(act_db_main, act_db_repl, db_info[act_db_main,'db_full_path'], db_info[act_db_repl,'db_full_path'])
        else:
            drop_db_objects(act_db_main, act_db_repl, capsys)
            # Must be EMPTY:
            run_errors_map['out_drop'] = capsys.readouterr().out
    
        if max(v.strip() for v in run_errors_map.values()):
            print(f'Problem(s) detected, check run_errors_map:')
            for k,v in run_errors_map.items():
                if v.strip():
                    print(k,':')
                    print(v.strip())
                    print('-' * 40)
    
>       assert '' == capsys.readouterr().out
E       AssertionError: assert   
E         - Problem(s) detected, check run_errors_map:
E         - repl_tx_not_found_err :
E         - UNEXPECTED outcome: pattern 'Error:\s+Transaction\s+\d+\s+(is\s+)?not\s+found' must not occur in log but was ENCOUNTERED there for 21 seconds.
E         - replication log diff:
E         -    0 ---
E         -    1 +++
E         -    2 @@ -5423,3 +5423,82 @@
E         -    3  deb10build1 (replica) Thu Feb 20 09:24:38 2025
E         -    4  	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -    5  	VERBOSE: No new segments found, suspending
E         -    6 +
E         -    7 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
E         -    8 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -    9 +	VERBOSE: Added 2 segment(s) to the queue
E         -   10 +
E         -   11 +deb10build1 (replica) Thu Feb 20 09:24:41 2025
E         -   12 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   13 +	VERBOSE: No new segments found, suspending
E         -   14 +
E         -   15 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
E         -   16 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   17 +	VERBOSE: Added 2 segment(s) to the queue
E         -   18 +
E         -   19 +deb10build1 (replica) Thu Feb 20 09:24:44 2025
E         -   20 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   21 +	VERBOSE: No new segments found, suspending
E         -   22 +
E         -   23 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
E         -   24 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   25 +	VERBOSE: Added 2 segment(s) to the queue
E         -   26 +
E         -   27 +deb10build1 (replica) Thu Feb 20 09:24:47 2025
E         -   28 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   29 +	VERBOSE: No new segments found, suspending
E         -   30 +
E         -   31 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
E         -   32 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   33 +	VERBOSE: Added 2 segment(s) to the queue
E         -   34 +
E         -   35 +deb10build1 (replica) Thu Feb 20 09:24:50 2025
E         -   36 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   37 +	VERBOSE: No new segments found, suspending
E         -   38 +
E         -   39 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
E         -   40 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   41 +	VERBOSE: Added 3 segment(s) to the queue
E         -   42 +
E         -   43 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
E         -   44 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   45 +	ERROR: connection shutdown
E         -   46 +	Database is shutdown.
E         -   47 +	At segment 6, offset 48
E         -   48 +
E         -   49 +deb10build1 (replica) Thu Feb 20 09:24:53 2025
E         -   50 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   51 +	VERBOSE: Disconnecting and suspending
E         -   52 +
E         -   53 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   54 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   55 +	VERBOSE: Added 3 segment(s) to the queue
E         -   56 +
E         -   57 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   58 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   59 +	VERBOSE: Database sequence has been changed to 5, preparing for replication reset
E         -   60 +
E         -   61 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   62 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   63 +	VERBOSE: Segment 4 (15729380 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
E         -   64 +
E         -   65 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   66 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   67 +	VERBOSE: Segment 5 (646 bytes) is scanned in 0.004s, preserving (OAT: 29 in segment 4)
E         -   68 +
E         -   69 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   70 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   71 +	VERBOSE: Resetting replication to continue from segment 6 (new OAT: 29 in segment 4)
E         -   72 +
E         -   73 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   74 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   75 +	VERBOSE: Added 3 segment(s) to the queue
E         -   76 +
E         -   77 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   78 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   79 +	ERROR: Transaction 29 is not found
E         -   80 +	At segment 6, offset 48
E         -   81 +
E         -   82 +deb10build1 (replica) Thu Feb 20 09:25:00 2025
E         -   83 +	Database: /home/fbqa/qa-2024/unpacked-snapshot.tmp/examples/empbuild/qa_replication/db_repl.fdb
E         -   84 +	VERBOSE: Disconnecting and suspending
E         - ----------------------------------------

tests/functional/replication/test_make_async_reinit_reliable.py:689: AssertionError
Full history of outcomes and elapsed time, ms:
NN SNAP_INFO CS_outcome SS_outcome CS_run_time SS_run_time CS_run_beg CS_run_end SS_run_beg SS_run_end
1 5.0.3.1657 2025.06.19 4bd4c F F 49564 49997 2025.06.26 12:24:33.652 2025.06.26 12:25:23.216 2025.06.26 11:02:01.407 2025.06.26 11:02:51.404
2 5.0.3.1657 2025.06.11 dae6f F F 49728 50132 2025.06.17 07:36:43.467 2025.06.17 07:37:33.195 2025.06.17 06:13:11.021 2025.06.17 06:14:01.153
3 5.0.3.1657 2025.06.10 dbc92 F F 47318 49613 2025.06.11 12:27:44.599 2025.06.11 12:28:31.917 2025.06.11 10:55:53.632 2025.06.11 10:56:43.245
4 5.0.3.1656 2025.05.20 c4b11 F F 47103 47230 2025.06.10 12:21:31.665 2025.06.10 12:22:18.768 2025.06.10 10:53:41.238 2025.06.10 10:54:28.468
5 5.0.3.1652 2025.05.13 f51c6 F F 52611 49956 2025.05.20 05:26:46.422 2025.05.20 05:27:39.033 2025.05.20 03:46:38.837 2025.05.20 03:47:28.793
6 5.0.3.1651 2025.04.30 141ef F F 56165 46617 2025.05.13 12:24:52.164 2025.05.13 12:25:48.329 2025.05.13 10:43:35.695 2025.05.13 10:44:22.312
7 5.0.3.1650 2025.04.28 4cbff F F 53054 50551 2025.05.01 11:58:37.580 2025.05.01 11:59:30.634 2025.05.01 10:18:15.047 2025.05.01 10:19:05.598
8 5.0.3.1649 2025.04.21 5b2d0 F F 50745 50553 2025.04.28 05:56:21.822 2025.04.28 05:57:12.567 2025.04.28 04:17:49.279 2025.04.28 04:18:39.832
9 5.0.3.1648 2025.04.18 2f4c5 F F 53171 50843 2025.04.20 05:47:58.694 2025.04.20 05:48:51.865 2025.04.20 04:12:05.800 2025.04.20 04:12:56.643
10 5.0.3.1635 2025.03.31 22ec6 F F 47749 50694 2025.04.18 12:11:17.450 2025.04.18 12:12:05.199 2025.04.18 10:31:25.715 2025.04.18 10:32:16.409
11 5.0.3.1633 2025.03.28 3123a F F 50475 50997 2025.03.31 10:44:18.650 2025.03.31 10:45:09.125 2025.03.31 09:11:16.405 2025.03.31 09:12:07.402
12 5.0.3.1633 2025.03.27 e0fb8 F F 50360 46826 2025.03.28 11:19:54.036 2025.03.28 11:20:44.396 2025.03.28 09:45:05.009 2025.03.28 09:45:51.835
13 5.0.3.1631 2025.03.21 1925b F F 50470 50510 2025.03.27 11:07:31.849 2025.03.27 11:08:22.319 2025.03.27 09:32:29.947 2025.03.27 09:33:20.457
14 5.0.3.1628 2025.03.14 16d05 F F 34906 34671 2025.03.17 08:42:05.254 2025.03.17 08:42:40.160 2025.03.17 06:57:54.017 2025.03.17 06:58:28.688
15 5.0.3.1627 2025.02.26 4e218 F F 37174 35156 2025.03.14 11:56:19.083 2025.03.14 11:56:56.257 2025.03.14 10:11:21.706 2025.03.14 10:11:56.862
16 5.0.3.1624 2025.02.25 dc3b2 F F 34965 31666 2025.02.26 10:46:45.022 2025.02.26 10:47:19.987 2025.02.26 09:06:56.450 2025.02.26 09:07:28.116
17 5.0.2.1615 2025.02.20 4a726 F F 32370 32251 2025.02.25 11:13:08.265 2025.02.25 11:13:40.635 2025.02.25 09:32:09.248 2025.02.25 09:32:41.499
18 5.0.2.1615 2025.02.14 9cb76 F F 34664 31753 2025.02.20 08:02:18.661 2025.02.20 08:02:53.325 2025.02.20 06:25:01.408 2025.02.20 06:25:33.161
19 5.0.2.1577 2024.12.24 3c80e F F 35780 31808 2025.02.14 11:16:37.900 2025.02.14 11:17:13.680 2025.02.14 09:38:33.683 2025.02.14 09:39:05.491
20 5.0.2.1576 2024.12.17 646b0 F F 27040 23582 2024.12.24 20:36:34.360 2024.12.24 20:37:01.400 2024.12.24 17:22:11.904 2024.12.24 17:22:35.486
21 5.0.2.1575 2024.12.08 63d39 F F 27677 26433 2024.12.16 08:17:43.793 2024.12.16 08:18:11.470 2024.12.16 07:04:47.373 2024.12.16 07:05:13.806

Elapsed time, ms. Chart for last 21 runs:

Last commits information (all timestamps in UTC):