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

Warnings are not returned from attachDatabase() call [CORE4162] #4489

Closed
firebird-automations opened this issue Aug 4, 2013 · 26 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Attachments:
test_output_FB25.txt
test_output_FB30a1.txt
DialectTest.java

Changing the dialect of a database using the dpb item isc_dpb_set_db_sql_dialect should return a warning ("Database dialect being changed from 3 to 1", error 335544802). This works correctly under Firebird 2.5 and earlier, but with Firebird 3.0 alpha 1 the dialect is changed, but no warning is returned to the client.

Background: the Jaybird test org.firebirdsql.jdbc.FBDriver.testWarnings() uses this to check processing of warnings by the driver.

Commits: f5e0fff FirebirdSQL/fbt-repository@cf45818

====== Test Details ======

Waiting for reply on issue 15/Nov/16 07:35 PM.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Test + output on Firebird 2.5.2 update 1 and Firebird 3.0 alpha 1 attached

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

Attachment: test_output_FB25.txt [ 12355 ]

Attachment: test_output_FB30a1.txt [ 12356 ]

Attachment: DialectTest.java [ 12357 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @aafemt

I would say that on FB3 it should be not warning, but error.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

It would be interesting to know whether other types of warnings are returned to the client or not.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

I'd love to test that, but I can't quickly think of another action that triggers a warning. Any suggestions?

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

For example yo may try to perform 2 attachments to same database in embedded mode, second - with isc_dpb_config paraneter in DPB. Should produce warning
Secondary attachment - config data from DPB ignored

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Alex, warnings are lost when copying from tdbb_status_vector to the caller's IStatus. I suspect the guilty routines are fb_utils::statusLength() and fb_utils::copyStatus(). The former has some commented out code related to warnings but its counting looks incorrect at the first glance. The latter needs similar corrections. But maybe something else remains hidden. At least after fixing them I still don't see the warning delivered to the y-valve.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

summary: Changing dialect through DPB does not return a warning => Warnings are not returned from attachDatabase() call

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

The reason was multiple thread contexts (one on top of another). Destructor of inner context places correct status vector to user's IStatus, but after it destructor of outer context was overwriting a warning with it's clean status vector.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 2 [ 10560 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Issue occurs again in recent versions (tested in snapshot 3.0.0.31721-0_x64). I haven't tested snapshots recently, so I don't know when this problem was reintroduced.

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

status: Closed [ 6 ] => Reopened [ 4 ]

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Might this be related to this set of changes: https://sourceforge.net/p/firebird/code/61033 ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

This might be related but in isql I get:

#⁠ ./isql -z -s 1 employee
ISQL Version: LI-T3.0.0.31733 Firebird 3.0 Beta 2

WARNING: This database speaks SQL dialect 3 but Client SQL dialect was set to 1 .
Server version:
LI-T3.0.0.31733 Firebird 3.0 Beta 2
Database: employee
SQL>

I.e. this seems to be java-specific.
So the question is - how to run provided test? When trying to compile it I get:

#⁠ javac DialectTest.java
DialectTest.java:46: '{' expected
try (Connection con = DriverManager.getConnection(JDBC_URL + "?charSet=iso-8859-1&set_db_sql_dialect=1", USER, PASSWORD)) {

It's
#⁠ javac -version
javac 1.6.0_12

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

The example code requires Java 7 or higher as it uses try-with-resources (introduced in Java 7). Instead you could also use the org.firebirdsql.jdbc.TestFBDriver.testWarnings() test in the Jaybird testsuite.

However I also tested with the snapshot of this morning and with that version the test passes again, so the problem seems to have been fixed again.

To recap:
* WI-T3.0.0.31374 Firebird 3.0 Beta 1 : works
* WI-T3.0.0.31721 Firebird 3.0 Beta 2 : fails
* WI-T3.0.0.31733 Firebird 3.0 Beta 2 : works

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

There were some postfixes. But:

#⁠ ./isql -z employee -s 1
ISQL Version: LI-T3.0.0.31721 Firebird 3.0 Beta 2

WARNING: This database speaks SQL dialect 3 but Client SQL dialect was set to 1 .
Server version:
LI-T3.0.0.31721 Firebird 3.0 Beta 2
Database: employee
SQL>

Anyway - if in current trunk issue is not reproduced I think an issue can be closed.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Using isql is not a correct reproduction: isql -s 1 doesn't set the dialect of the database, it sets the dialect of the connection. That warning is generated inside isql (see isql.epp line 5798), and not server side.

My test uses isc_dpb_set_db_sql_dialect which generates the warning isc_dialect_reset_warning (or 335544802: Database dialect being changed from 3 to 1).

But I think this can be closed again.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Reopened [ 4 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

Fix Version: 3.0 Alpha 2 [ 10560 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

One small question has shown up: why message about changing dialect from 3 to 1 appears *only* in 2.1.7 and *only* when we change this attribute using GFIX utility ?

Following is simple test:

1) FB 2.1.7, Classic:

1.1) change dialect from 1 to 3 and return it to 1 using GFIX only:
C:\MIX\firebird\oldfb21\bin>gfix -sq 3 /3217:e21 & gfix -sq 1 /3217:e21 & gfix -z
STDOUT:

Database dialect being changed from 3 to 1
gfix version WI-V2.1.7.18553 Firebird 2.1

(OK, expected: gfix *does* report about changing dialect)

1.2) change dialect from 1 to 3 using GFIX, and return it to 1 using FBSVCMGR:
gfix -sq 3 /3217:e21 & fbsvcmgr localhost/3217:service_mgr action_properties prp_set_sql_dialect 1 dbname e21

STDOUT: empty (and this seems strange). STDERR: also empty.

2) FB 2.5.5, SuperClassic:

2.1) change dialect from 1 to 3 and return it to 1 using GFIX only:
C:\MIX\firebird\fb25\bin>gfix -sq 3 /3255:e25 & gfix -sq 1 /3255:e25 & gfix -z
STDOUT:

gfix version WI-V2.5.5.26952 Firebird 2.5

// no message about changing dialect from 3 to 1; why ?

2.2) change dialect from 1 to 3 using GFIX, and return it to 1 using FBSVCMGR:
gfix -sq 3 /3255:e25 & fbsvcmgr localhost/3255:service_mgr action_properties prp_set_sql_dialect 1 dbname e25
STDOUT: empty. STDERR: also empty.

3) FB 3.0, SuperServer:

3.1) change dialect from 1 to 3 and return it to 1 using GFIX only:
C:\MIX\firebird\fb30>gfix -sq 3 /3333:e30 & gfix -sq 1 /3333:e30 & gfix -z
STDOUT:

gfix version WI-V3.0.0.32157 Firebird 3.0 Release Candidate 1

// also no message about changing dialect from 3 to 1; why ?

3.2) change dialect from 1 to 3 using GFIX, and return it to 1 using FBSVCMGR:
gfix -sq 3 /3333:e30 & fbsvcmgr localhost/3333:service_mgr action_properties prp_set_sql_dialect 1 dbname e30
STDOUT: empty. STDERR: also empty.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

What about fbsvcmgr the reason is trivial - it does not check for warnings

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Sorry for repeating old question, but once again: why message about changing dialect from 3 to 1 appears *only* in 2.1.7 ?
Trivial batch illustrates this:

@echo off
set fb21bin=C:\MIX\firebird\oldfb21\bin
set fb25bin=C:\MIX\firebird\fb25\bin
set fb30bin=C:\MIX\firebird\fb30Cs
set fb40bin=C:\MIX\firebird\fb40Cs
@echo on
%fb21bin%\gfix -sq 3 /3217:e21 & %fb21bin%\gfix -sq 1 /3217:e21 & gfix -z
%fb25bin%\gfix -sq 3 /:e25 & %fb25bin%\gfix -sq 1 /:e25 & gfix -z
%fb30bin%\gfix -sq 3 /:e30 & %fb30bin%\gfix -sq 1 /:e30 & gfix -z
%fb40bin%\gfix -sq 3 /:e40 & %fb40bin%\gfix -sq 1 /:e40 & gfix -z

- you will get warning (error ?) only in 2.1.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Deferred

Test Details: Waiting for reply on issue 15/Nov/16 07:35 PM.

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