[firebird-support] Partial update

2017-02-13 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
   Hello, All.

   If I use prepared statement like this "update table set field1=?, field2=? 
where 
field3=?" for performance reasons, is there a way to update only some fields 
and leave 
other untouched without overhead of building separate queries on the fly or 
selecting old 
values with different query?

-- 
   WBR, SD.






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



RE: [firebird-support] Weird behaviour

2017-02-13 Thread 'Leyne, Sean' s...@broadviewsoftware.com [firebird-support]


> A thread is trying to perform a SQL select, a client wants to display detailed
> information for a certain row.
> Basicly Select * from TABLE where PKEY = PKEY
> The thread acquires lock in our server, then works it's way through GDS32.dll
> (fbclient.dll) and then times out on the call to WinSock2 select (I guess it
> retries if no success, because it never returns).
> MON$STATEMENT shows a stalled SQL statement corresponding to the SQL
> statement above.

Please review the database "Sweep Interval" setting (IMO, it should be = 0) -- 
your query could be getting caught up with a database sweep.


Sean



[firebird-support] Deadlock - expected behaviour

2017-02-13 Thread john_karlsson_...@yahoo.com [firebird-support]
Hi All!
I have currently been looking into an issue where one of our clients seem to be 
experiencing a deadlock. However I am not a Firebird expert so I think I might 
need some help, hopefully someone could point me in the right direction. In 
short:


I have narrowed it down to being due to one of our threads on the server 
acquiring a lock then entering gds32.dll (fbclient.dll) never to return. 


An memory dump taken early in the investigation seemed to indicate a hang in 
winsock2 select method.


During my investigation I have made some memory dumps + modified the source of 
fbclient for improved trace logging. I have also added configuration regarding 
connection and dummy message timout, since it seems that these values are 
sometimes used as the timeout value for the winsock2 select call. In order to 
make sure that the thread does not hang in a blocking winsock call I also 
changed to code (in fbclient.dll) so that timeout is always set. The conclusion 
is that the select call never returns a FD_SET for the thread causing the hang. 
MON$STATEMENTS show that I have a stalled statement timestamped at around the 
time of the hang. The SQL in the statement corresponds to the SQL expected to 
be executed by the thread that is causing the hang ( a SELECT statement).


We are using:Firebird 2.5.4 (in our clients system), Firebird 2.5.6 in our test 
systemibproviderV2MDAC 2.7
The system is a client server application, 4 clients connected to a server 
application which utilizes Firebird. The server application and Firebird 
coexists on the same physical machine.


Question is, could this occur because we are using WAIT transactions (which is 
the deafult if I have understood correctly), or bad management of 
transactions(I have used fb_lock_print for one reproduced hang without finding 
any lock blocks)? Or is it an firebird issue?
More information from memory dumps/trace etc. can be provided upon request
Thanks in advance!/John Karlsson




[firebird-support] Weird behaviour

2017-02-13 Thread john_karlsson_...@yahoo.com [firebird-support]
Hi All,



I have encountered something that I would describe as weird behaviour, although 
I must admit that I'm not an expert on Firebird and cannot say whether this 
should be expected or not. So... first some basic info:
We have a system which relies on Firebird for persistent storage. The system is 
fairly mature however new functions are added as needed.

The system uses firebird 2.5.4 superserver, ibproviderv2 and MDAC 2.7, however 
when researching the issue I have updated our reference system to firebird 
2.5.6 since source-code and pdb's were available for this version. The issue 
still occurs using 2.5.6. We are using WAIT transactions (e.g. the default 
transaction mode).

A thread is trying to perform a SQL select, a client wants to display detailed 
information for a certain row.
Basicly Select * from TABLE where PKEY = PKEY
The thread acquires lock in our server, then works it's way through GDS32.dll 
(fbclient.dll) and then times out on the call to WinSock2 select (I guess it 
retries if no success, because it never returns).
MON$STATEMENT shows a stalled SQL statement corresponding to the SQL statement 
above.

So it all boils down to is this behavior due to bad transaction management on 
our part or is it an issue with firebird?


Background + additional info:
I have been looking into an issue reported by one customer where the system 
seem to deadlock when working with a specific table. In the configuration used 
the system has four clients operating against a server which in turn utilizes 
Firebird.
Now the clients basically displays the table as a grid. The user can "open" a 
row in order to display more detailed information. When this occurs the server 
changes the state of the row (we have a column in the databese for this) to 
open. The user choose to perform an operation on the row (changing the same 
column) and closes the detailed view again changing status of the row. For each 
status change the clients will reload the row in order display updated 
information.

Now everything seems to be working OK when doing work from only one client. 
When working with two clients at a moderate pace things are also working OK. 
But at a high (to frantic) pace a deadlock will occur within 15 minutes. Which 
might suggest some kind of race condition. The thing is that these status 
changes I mentioned when describing the "work flow" can be done with the 
keyboard using a command sequence similar to [Ctrl+O], [Ctrl+O], [Enter] 
allowing the user to change the status 3 times in less than a second. And when 
I write high pace thats what I mean. So in order to reproduce the issue(at the 
office) I need two users hammering away at their keyboards for 15 minutes. 
Please note that the table in this case contains less than 1 rows, 
sometimes as few as a 1000 rows. However at the customers site the problem is 
easier to reproduce. There the issue seem to occur when having one user working 
at high pace and one doing the work flow at lets say 15 seconds per row. The 
hardware is the same in these cases(model,manufacturer etc), the users are 
different though so maybe the reason why it's harder to reproduce at the office 
(the network should have the same topology etc.)

So, since this seemed to be a deadlock which I presumed occurred within the 
scope of our server I created memory dump which showed a deadlock where one 
server side thread had acquired a lock in our server and then seemed to be 
stuck on the winsock call 'select' but I could not get at decent stacktrace due 
to missing symbol files. I have since then changed the firebird to version 
2.5.6/downloaded symbolfiles and also inserted some very basic trace-logging 
around the suspected culprit(the select call). I have also set the network 
timeout values in the firebird.conf since code review in fbclient showed these 
might be used as timeout parameter to the winsock2 select call.
 I have also added a some code to make sure a blocking call to select doesn't 
occur (always set the timeout if not set). However the timeout used when 
reproducing the issue comes from the firebird.conf file. After these 
modifications I have deduced the following:


Info from memory dump and my tracelogs etc are available upon request.

Thank you in advance!

/John Karlsson