cancel
Showing results for 
Search instead for 
Did you mean: 

How do I simulate assertions with SQL Anywhere 16?

Breck_Carter
Participant
4,027

I want test the behavior of various dbsrv16 -ufd option settings when server-level and database-level assertions occur.

I don't care what the assertion codes are, so fakes are OK.

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

One way to generate assertions would be to create a database and then corrupt it by changing the checksum on one of the database pages.

WARNING: DO NOT DO THIS ON ANY DATABASE WITH REAL DATA !!

dbinit bad.db
perl corrupt_the_database.pl bad.db

where corrupt_the_database.pl is the perl script containing:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#
# Corrupt the checksum on page 3 of a SQL Anywhere database
# !! USE WITH EXTREME CARE !!
#
chmod( 0777, $ARGV[0] );
open( FOO, "+<$ARGV[0]" ) || die $?;
binmode( FOO );
seek( FOO, 3*4096-4, 0 ) || die $?;
print( FOO '\\0\\0\\0\\0' ) || die $?;
seek( FOO, 0, 2 );
close( FOO );

When you start the database on bad.db (e.g. "dbeng16 bad.db") the server will generate a "Checksum failure" assertion.

Breck_Carter
Participant
0 Kudos

Presumably, that is a permanent error condition. Is there any way to cause a transient assertion, one that would allow dbsrv16 -ufd restart to successfully restart the database?

MarkCulp
Participant
0 Kudos

Yes, the corrupted checksum failure would be a permanent condition and therefore the restart attempt would fail.

I do not know of any publicly available way of causing a temporary assertion.

Perhaps one way would be to create a user table, put some data in it, add an index, shutdown the database, and then corrupt the index using a method similar to the above process. Starting the database on such a table would succeed but accessing the table may cause an assertion if the corruption was "just right". Again this type of corruption would be permanent but the restart of the database would succeed.

Breck_Carter
Participant
0 Kudos

Soooo... a valuable new feature exists with no way to prove it... 🙂

MarkCulp
Participant

Well, we've proved it in house... but I'm working on a method for you to prove it to yourself... give me a few more minutes days.

Breck_Carter
Participant
0 Kudos

Take all the time you need, take weeks!


Re How do I simulate assertions with SQL Anywhere 16

Answers (1)

Answers (1)

VolkerBarth
Contributor
0 Kudos

Well, the typical EBF readme does contain several bug fixes for (temporary) assertions - some of them are declared with "under very rare circumstances" and the like, others sound reproducable.

Is that a starting point?

Yes, I know, v16 is brandnew, so there are no EBFs and readmes available yet...

VolkerBarth
Contributor
0 Kudos

@Breck: Are you working on "The top 10 cool features of SQL Anywhere 16"? (In case that allows for a publicly available answer:))

Breck_Carter
Participant

@Volker: What a great idea, someone should write that!

VolkerBarth
Contributor
0 Kudos

Well, someone seems to have just done that:

Top 10 Cool New Features in SAP Sybase SQL Anywhere 16...


Isn't that a smart "nearly-invisible announcement":)