ora_migrator icon indicating copy to clipboard operation
ora_migrator copied to clipboard

Sequences catchup regression tests

Open lemrouch opened this issue 3 years ago • 5 comments

Hi, I'm trying to write tests as you have asked me to. So far I was able to figure out the database needs

datestyle = 'Postgres, MDY'
intervalstyle = 'postgres_verbose'

but I'm still unable to get exactly the same output as in check_results.out. I have no idea what is check_results_1.out good for.

I guess you want me just to add SELECT testschema1.seq1.NEXTVAL FROM dual; to migrate.sql, SELECT nextval('testschema1.seq1'); to check_results.sql and add relevant output to check_results.out. Right? BTW: This might hinder subsequent runs of the check.

lemrouch avatar Nov 02 '22 13:11 lemrouch

Before I try to answer, let me express my thanks for all your work and improvements on this project. I really appreciate it!

datestyle and intervalstyle are set by the regression test machinery when you run the regression tests. I realize that I did not document that, so I have added some documentation in 4f09cf8abefd22ac1e37b7098c6f6b6386303a7a.

If you get any different results, that could be an artifact of my PostgreSQL configuration. Share your results, and hopefully I can fix the regression tests. check_results_1.out is an "alternate result file". Git tells me that I added that in 75c89fad971bd435cf3d6900025646f8cba35656 because \d changed its output in v11. I guess the old result file is obsolete by now and could be removed (and the new one renamed).

My idea how sequences could be tested is that you add one or two NEXTVAL calls (using oracle_execute) to migrate.sql in the section /* add some test data for replication */ and check the value of the local sequence after /* clean up replication tools */. You should reset the Oracle sequence in /* clean up Oracle test data */ so that the next regression test finds it in the original state.

laurenz avatar Nov 03 '22 10:11 laurenz

add one or two NEXTVAL

was my original idea as well but it's way too optimistic. We have to deal with sequence created with CACHE 10 and we are catching up it's high watermark, not the real last value. We would have to cross the cache size to see any change in PG sequence.

lemrouch avatar Nov 03 '22 10:11 lemrouch

Oh, I'd keep it simple. I added to CACHE 10 only to see if the property was migrated. You can simply create another sequence with CACHE 1 and use that for your test.

laurenz avatar Nov 03 '22 11:11 laurenz

You can simply create another sequence with CACHE 1 and use that for your test.

Fun fact is that you can't: ORA-04010: the number of values to CACHE must be greater than 1

lemrouch avatar Nov 14 '22 11:11 lemrouch

Then omit the CACHE clause altogether.

laurenz avatar Nov 14 '22 20:11 laurenz