[firebird-support] Re: Shutting down the server - active sevice(s)

2014-04-29 Thread hvlad
  Yes, you definitely have a problem. Sooner of all some client code is 
attached to the services manager and forgot to detach. Trace could help you to 
identify that client application and what service it is used.

Regards,
Vlad
 



Re: [firebird-support] Readcomitted ReadOnly Transaction - Commit or Rollback?

2014-02-27 Thread hvlad
> I'm confused. I thought that read-only read-committed transactions did not 
> consume transaction ids. 
> By  nature they don't need the protection of the transactional system. They 
> don't make changes so 
> there's no need to roll back. Nor is there any need to prevent others from 
> reading their uncommitted
> changes. They don't offer consistent reads, so they don't need to prevent 
> garbage collection. Why 
> do they need unique transaction identifiers?
 
  It is how RO RC transactions was implemented at IB6 :) We discussed this long 
time ago and decided
to leave it as is (i.e. to left RO RC transactions to have own numbers) by the 
following reasons:
a) monitoring: transactions naturally identified by transaction_id 
b) temporary tables: GTT's are writable in RO RC transactions 

Regards,
Vlad





[firebird-support] RE: Embedded and Services Manager on Windows

2014-02-27 Thread hvlad
> Another quick update. TIBBackupService does actually work, you just have to 
> know that it does nasty things like this inside the ServerName setter method
 > 
> if (FProtocol = Local) and (FServerName <> '') then
>   FProtocol := TCP
> 
> I was updating the protocol to Local in the occasion that the embedded 
> library was used by the application or TCP when the full server is available. 
>  
> Unbeknownst to me, when the hostname was set, it reverted back to TCP and 
> therefore tried to access using my full server.

  So, you set "ServerName" to hostname ? Why do you need it for embedded 
connection ???
Also there is Firebird server running at the same host ? I guess - as a service 
? Do you see another instance there ?

Regards,
Vlad




[firebird-support] RE: Embedded and Services Manager on Windows

2014-02-27 Thread hvlad
> Hello Group,
 > Is it possible to take a backup of a 2.5 database whilst it is running in 
 > embedded mode (Windows) and whilst that application is otherwise 
> connected to the database using the services manager (just like you can on 
> the full server)?

  Sure

> I am presently getting an exception that the database is opened by another 
> engine instance but process explorer only identifies my 
> application as having a handle to it.

Sooner of all that another instance run at another windows session (by 
another user). In this case windows security model makes 
named kernel objects (such as events, MMF's and so on) "private" within the 
session and not accessible from another session. It not
allows Firebird engines (hosted by user applications in different sessions) to 
coordinate with each other.

Make sure you run PE with elevated privileges to see processes at another 
sessions.

Regards,
Vlad




Re: [firebird-support] RE: Where I put firebird.msg on PC with two client?

2014-02-22 Thread hvlad

 

 >  Why do you think you can't use just v2.5 client ?


>isn't  supported from Zeoslib for Delphi 5 :(

Sounds crazy, sorry. Can you provide a reason for it ? Just curious...


 >  Choose any folder you like, put firebird.msg there and set environment 
 > variable
 >FIREBIRD_MSG pointing to this folder. You should set it before you'll load 
 >fbclient.dll.





> In this case, I have conflict with version 2.5 (in this case nt works fine 
> the 2.5 version) because environment 
> variable is in system scope. Is there a way to set an environment variable in 
> scope only for application that set it?
 
Sure. You can
a) run your application using bat\cmd file with two lines
SET FIREBIRD_MSG= 


or you can
b) call WinApi function SetEnvironmentVariable before attempt to load 
fbclient.dll
 

 



[firebird-support] RE: Where I put firebird.msg on PC with two client?

2014-02-21 Thread hvlad
---In firebird-support@yahoogroups.com,  wrote:
 > Hallo,
 > I have a PC with two clients:
> - fbclient21.dll (I use ZeosLib + Delphi) for version 2.1 in windows\system
> - fbclient.dll for version 2.5 in windows\system
 
  Why do you think you can't use just v2.5 client ?

> Both clients connect to the server version 2.5 and I cannot change this 
> unless I update the application that uses fbclient21.dll.
 
  What problem do you have ?

 > If I put firebird.msg in Windows\system I create a conflict by different 
> versions of clients (2.1 + 2.5).
 
  Nope. But you better should not put non-system files into Windows system 
folder

 > There is a way to put firebird.msg for 2.1 version in a directory that 
 > not conflict with the one for version 2.5?
 
  Choose any folder you like, put firebird.msg there and set environment 
variable
FIREBIRD_MSG pointing to this folder. You should set it before you'll load 
fbclient.dll.
But, again, you have no reason to do it.

Regards,
Vlad




[firebird-support] RE: nbackup questions

2014-01-15 Thread hvlad
> From your earlier postings, I gather that in May 2013 nbackup failed to 
 > complete, so the main database file has been frozen for 8 months, and 
> all the changes since May 2013 have accumulated in the delta.
 
  This is too strong statement. To verify it we need to know physical backup
state of the database. gstat -h will show it (and it not requires admin 
privileges).

Regards,
Vlad

 


[firebird-support] RE: linker error in VS 2005

2013-12-24 Thread hvlad
---In firebird-support@{{emailDomain}},  wrote:

 > I am building an application with the firebird 2.5 API.  I keep getting the 
 > following errors at compile time.  I am using VS 2005 on win 7. 
 ...
> I have done extensive searching on the web for a solution to this.  
> Near as I can tell, I am missing an library file of some sort with the actual 
> functions in them. 

  Link against fbclient_ms.lib. It is placed at \lib subfolder of your Firebird 
installation.

Regards,
Vlad





Re: [firebird-support] RE: Security issues?

2013-12-19 Thread hvlad
---In firebird-support@{{emailDomain}},  wrote:
 
 On 18 Dec 2013 13:14:07 -0800, mailto:hvlad@...> wrote:
 >>> Besides the documented limitation that passwords are 8 characters 
 >>> (Firebird 3 will lift that limitation), the connection protocol is not
>>> encrypted meaning that people can sniff the traffic and determine the 
 >>> password.
 >> 
 >> Password is never passed over the wire in open form. It is encrypted by
>> client...
 
 > Yes, but that is still susceptible to a replay attack, so the fact that it
 > is encrypted doesn't actually matter for someone with the will and means,

  You said above that *password* could be determined by sniffer. This is not 
true and i said it.
I said nothing more.

> and of course several alternative wire protocol implementations (eg
> Jaybird) don't actually encrypt the password.
 
  So, people should not use such "alternative wire protocol implementations" if
they do not want to send clear passwords over the wire.

Regards,
Vlad




[firebird-support] RE: Security issues?

2013-12-18 Thread hvlad
---In firebird-support@yahoogroups.com,  wrote:

> Besides the documented limitation that passwords are 8 characters 
 > (Firebird 3 will lift that limitation), the connection protocol is not 
> encrypted meaning that people can sniff the traffic and determine the 
> password.
 
  Password is never passed over the wire in open form. It is encrypted by 
client...

Regards,
Vlad

 


RE: Odp: [firebird-support] RE: MON$IO_STATS -> M ON$PAGE_FETCHES - wrong values or as designed?

2013-12-12 Thread hvlad

 ---In firebird-support@yahoogroups.com,  wrote:

 
> My pagesize is 16k and pages cache is set to 65536. And this can not be that.
> I see in MON$PAGE_READS small value = 585 but in MON$PAGE_FETCHES value = 
> 120637. 
> Database have 6685 pages what is corelated with real db size = ~104MB

  Oops, i mixed reads vs fetches :) Fetch is access to the page in page cache. 
To process (select) 
one *row*, Fierbird need to make 2 fetches at least, for example. So, i see 
nothing strange here.

Regards,
Vlad




[firebird-support] RE: MON$IO_STATS -> MON$PAGE_FETCHES - wrong values or as designed?

2013-12-12 Thread hvlad
---In firebird-support@yahoogroups.com,  wrote:

 
 > In MON$IO_STATS - MON$PAGE_FETCHES field i see reads 120637 pages but my 
 > whole test database have only 6685 pages. > Is something wrong with counters 
 > when status of statement is 2 in field MON$STATE?

  Your page cache is definitely less than 6685, so some pages could be read 
from disk many times...

Regards,
Vlad




[firebird-support] RE: Table and Sequence names by reference

2013-11-09 Thread hvlad

 ---In firebird-support@yahoogroups.com,  wrote:

 > Is it possible to refer to internal structures by reference in PSQL?
 
  No. It is not possible. 

Regards,
Vlad

 


[firebird-support] RE: I dont know why sweep is not doing clean

2013-11-03 Thread hvlad
> Thank you for your help. I dont understand why sweep is not doing clean.
 > I use Super Server 2.5. I try also to run sweep manually and it ends 
 > immediatelly without doing clean.

  Make sure your database is not shutdown. Show us gstat -h output. 

Regards,
Vlad

PS And consider to remove "reserve" option




[firebird-support] RE: How to extract DDL event items involved in a DDL trigger (FB 3.0) from system tables?

2013-10-28 Thread hvlad
---In firebird-support@yahoogroups.com,  
wrote:
 
 > For my tool, I like to determine which DDL event items are involved in a DDL 
 > trigger (FB 3.0).

...
> But how can I query from rdb$triggers (rdb$trigger_type field) whether 
> 'CREATE TABLE' or 'ALTER CHARACTER SET' or any other DDL event is involved?

  They should be enumerated at RDB$TYPES but i see that DDL triggers is missed 
there.
Please, ask at fb-devel or at tracker about it.

Regards,
Vlad

PS you can find it at src/jrd/constants.h





[firebird-support] RE: Unecessary reads when update referenced table ?

2013-10-23 Thread hvlad
  Firebird itself doesn't access dependent tables if FK value was not changed 
by UPDATE statement.
Do you have UPDATE triggers ?

Regards,
Vlad

[firebird-support] RE: RE: oldest active transaction not available

2013-10-14 Thread hvlad
> the indices are used, but only the server knows why he scans the whole table. 
> > > SQL:
 > DELETE FROM
> DETAIL
> WHERE
> ID=? /* ID */

 > 
 > Execution Plan:
 > PLAN (DETAIL INDEX (I_DETAILS_ID))

 >

 > Statement Statistics:
 > Reads: 1,0 GB Inserts: 25 Indexed Reads: 25 > Writes: 180,0 KB Updates: 0 
 > Sequential Reads: 8.259.025 > Deletes: 25 Table Scan: 100%

  > 

1. Do you have complete execution stats, including fetches, 
backout\purge\expunge and so on ?
2. Do you run SS or CS ? If SS, you should know that tools such as isql\IBE 
reports stats for the whole database activity, not isolated by the single 
statement.
3. Do you have triggers for DELETE on this table ?

Regards,
Vlad





[firebird-support] RE: File-based write filter

2013-10-12 Thread hvlad
Petri,
 

 > When you are using File-Based Write Filter 

  Do you think all here knows what is "File-Based Write Filter"  ? I found that 
this is a feature of
Windows Embedded :

---
File-Based Write Filter (FBWF) enables redirection of all changes made to a 
protected volume to an in-memory overlay. This provides system designers with 
the option of discarding all changes made to a system in a manner that is 
transparent to user applications.
---

at http://msdn.microsoft.com/en-us/library/ff794219%28v=winembedded.60%29.aspx

And i wonder - how do you run Firebird at Windows Embedded ???

> is there something Firebird files which should be excluded.

  I'd said it is a question for the person who is going to use FBWF. Or you 
could
add some details about your concerns...

 > Start situation is that firebird is installed and configured to work 
 > correctly.
 

   On Windows Embedded ? Really ?


Regards,
Vlad





[firebird-support] RE: RE: oldest active transaction not available

2013-10-10 Thread hvlad

 > we use nbackup only
 > my gstat accept no parameter -list 
 

   It was a typo, i mean gfix of course

 

 > The transaction was cancelled after DB shutdown -> Firebird restart -> DB 
 > online. Then also sweep takes 

 > effect. 

 

   Then it was not a limbo transaction...

 

 > BUT: Sinatica Monitor alarmed me again because every delete statement still 
 > generate millions 

 > of sequential reads.

  Consider to add some indices to satisfy WHERE condition in your DELETE 
statement

Regards,
Vlad




[firebird-support] RE: oldest active transaction not available

2013-10-10 Thread hvlad
Do you have applications which used distributed transactions ? Such as 
replication software.
Run gstat -list  and show us results.
  
 Regards,
 Vlad

 



[firebird-support] RE: Can't connect to Firebird 2.1 as Local

2013-10-10 Thread hvlad
Make sure you are connecting to the 2.1 using fbclient from 2.1

FB 2.x and FB 1.x have different and not compatible implementations of local 
protocol, therefore you should use correct client version

Regards,
Vlad

[firebird-support] Re: Do global temporary tables have performance advantages over usual tables

2013-08-07 Thread hvlad


--- In firebird-support@yahoogroups.com, Huan Ruan wrote:
>
> >
> > The question is - do global temporary tables have performance advantages
> > over usual tables? And whether global temporary tables were designed with
> > optimization goal in mind at all? Maybe they have different goals?
> >
> I don't think global temporary tables (GTT) is designed purely for
> optimisation, but there can be some performance gains with using GTT.
> 
>1. Large deletion on usual tables can be very slow especially when there
>are lots of non unique indexes, generates lots of garbage, and sometimes
>can cause index corruptions as well. GTTs, especially transaction based
>GTTs, don't have this problem because typically you don't need to do
>deletion, The database engine just drops the whole instance of the GTT when
>you finish your work.
>2. GTT data (table data, index data and the related old versions and
>garbage), is stored outside of the normal database file so doesn't bloat
>the database size.
>3. In Firebird 2.5, you can do writings to GTT within a read-only
>transaction. This certainly improves performance. Read-only read committed
>transactions do not interfere with transaction housekeeping, i.e. OIT and
>OAT.
>4. Similar to the above point, I can imagine the database engine can
>utilise the fact that GTT data has limited visibilities for more
>optimisation.

  Good points. I can add:
5. FW is always OFF for temp file with GTT's data
6. There is no need to keep writes correctly ordered for GTT, therefore in some 
cases it require less writes then persistent tables.

Regards,
Vlad



[firebird-support] Re: Threading using multiple connections

2013-08-07 Thread hvlad
--- In firebird-support@yahoogroups.com, "Martijn Tonies" wrote:
>
> Hi Vlad,
> 
> >> >> Can someone let me know if the following is thread-safe:
> >> >>
> >> >> - a client library from Firebird version 1, 1.5, 2 or 2.1
> >> >> - using a connection per thread
> >> >> - executing calls via multiple threads
> >> >
> >> >  Add also: protect attach\detach calls with common mutex.
> >> 
> >> You mean that connect/disconnect cannot be done while another
> >> thread is already waiting for the API to return, right?
> > 
> >  It can be done of course, but there were reports about deadlocks in 
> > fbclient when few threads executed attach\detach concurrently. 
> > Note, you need to serialize attach\detach API's only, all other calls 
> > is safe (as long as you follow thread per attachment rule).
> > 
> > Hope it is clear now,
> 
> Thanks, also calls to Services API and so on follow the same rules?
> 
> Getting database info (pages/pagesize/etc)?

  I'd say - yes

Regards,
Vlad



[firebird-support] Re: Threading using multiple connections

2013-08-02 Thread hvlad
--- In firebird-support@yahoogroups.com, "Martijn Tonies" wrote:
>
> Hi Vlad,
> 
> >> Can someone let me know if the following is thread-safe:
> >>
> >> - a client library from Firebird version 1, 1.5, 2 or 2.1
> >> - using a connection per thread
> >> - executing calls via multiple threads
> >
> >  Add also: protect attach\detach calls with common mutex.
> 
> You mean that connect/disconnect cannot be done while another
> thread is already waiting for the API to return, right?

  It can be done of course, but there were reports about deadlocks in 
fbclient when few threads executed attach\detach concurrently. 
Note, you need to serialize attach\detach API's only, all other calls 
is safe (as long as you follow thread per attachment rule).

Hope it is clear now,
Vlad



[firebird-support] Re: Threading using multiple connections

2013-08-02 Thread hvlad
--- In firebird-support@yahoogroups.com, "Martijn Tonies" wrote:
>
> Hi all,
> 
> Can someone let me know if the following is thread-safe:
> 
> - a client library from Firebird version 1, 1.5, 2 or 2.1
> - using a connection per thread
> - executing calls via multiple threads

  Add also: protect attach\detach calls with common mutex.

Regards,
Vlad

PS v2.5 client should be free from the limitations above, you surely know it :)



[firebird-support] Re: gds32 cohexistance of different firebird installations

2013-08-01 Thread hvlad
--- In firebird-support@yahoogroups.com, "lem_ita_78" wrote:
...
> Is it possible to set something (a registry key, a config file, some other 
> trick) to tell windows where to look for this dll? 

  Yes, use instreg utility

> Is it possible to move this dll to an other folder removing it from 
> windows\system\ without malfunctions?

  Yes, put fbclient.dll\gds32.dll and firebird.msg into any folder you like,
run instreg -i from this folder before starting to use this instance and
run instreg -r from this folder after use of this instance.

Regards,
Vlad

PS since you are using BDE and want to move gds32.dll out from system folder you
should ensure that BDE driver is able to load correct version of gds32.dll. The
one of easy ways is to add folder with correct libraty to the PATH environment
variable right before run of your BDE application.




[firebird-support] Re: Firebird exits after using UDF, idle, rollback and exit

2013-06-12 Thread hvlad
--- In firebird-support@yahoogroups.com, Vitali Voroth wrote:
>
> Hi!
> 
> I'm not sure if the following is a bug, so i try it here first before posting 
> it to 
> firebird-devel. Chances are that somebody on this list can help me.
> 
> I am running the 64-bit version of Firebird 2.5.2 (26540) on Windows 7.
> I noticed that the server crashes after using a udf compiled with FreePascal,

  Unfortunately, FPC for Win64 contains a bug with exceptions handling. See

http://mantis.freepascal.org/bug_view_page.php?bug_id=17360

Vlad

PS looks like it is finally fixed in FPC v2.7.x



[firebird-support] Re: Array, the last Samurai or Mission impossible ?

2013-05-24 Thread hvlad


--- In firebird-support@yahoogroups.com, "stoneoldrock" wrote:
>
> Hi, all (and Vlad)
> 
> I was here to ask help about BLOB, and it helped a lot.
> 
> Now I have developed a function which can load multiple (different) files 
> into multiple blob columns by INSERT or UPDATE with a single function call, 
> after that help, thanks.
> 
> Encouraged by this I am going to explore the array, an abundant and lonely 
> field seldom attended by anyone( but still useful).
> 
> The following codes are NOT working, would anyone like to point out where is 
> wrong? 
...
>   the table with array column is as:
> 
>   table name:TBL_D
>   column name:   FLD_ARRA CHAR(20)[5]
>   
>   SQL:UPDATE TBL_D SET FLD_ARRA = ?  where FLD_SML = 100 
>
>   char *arr_buf[] = { "AAA", "AAA", "AAA", "AAA", "AAA" };

  For CHAR(20) data type you must supply buffer of 20 bytes per item. 
Or you could leave this C-data as is but modify data type at array 
descriptor returned by Firebird - try to set it to the blr_cstring 
(it should be blr_text when you retrieve it from engine). I don't know 
if this trick will work. If not - supply correct CHAR(20) data.

Hope this helps,
Vlad



[firebird-support] Re: XSQLDA && error code = -804

2013-05-14 Thread hvlad


--- In firebird-support@yahoogroups.com, "stoneoldrock" wrote:
... 
>   There is now NO more error message, for the function hangs inside  the 
> isc_dsql_execute_immediate(..) call, and NEVER gets out...
> 
>  any further suggestions?

  Sooner of all you have not committed concurrent update or delete of the 
same row. As your transaction have no TPB it used default parameters and 
wait's infinite for concurrent updates.

Regards,
Vlad



[firebird-support] Re: XSQLDA && error code = -804

2013-05-13 Thread hvlad


--- In firebird-support@yahoogroups.com, "stoneoldrock" wrote:
>
> Hi, all
> 
> I am coming into a XSQLDA problem, would anyone of you like to point out 
> where is wrong in the following code?  

...

>in_sqlda->sqlvar[0].sqldata = (char *) &blob_id;
>in_sqlda->sqlvar[0].sqltype = SQL_BLOB+1;

(1) here you say: the field\parameter is nullable

>in_sqlda->sqlvar[0].sqllen =  strlen(blob_buffer);

(2) here you must put sizeof(blob_id)

>in_sqlda->sqlvar[0].sqlind =  NULL;

and here you must supply NULL-indicator because of (1)

Regards,
Vlad




[firebird-support] Re: How to read the "Memory buffers" size via SQL?

2013-04-25 Thread hvlad
--- In firebird-support@yahoogroups.com, "Fabiano Kureck" wrote:
>
> Hi!
> 
>  
> 
> I must read the "Memory Buffers" parameter from the database using sql.
> 
> I know that I can use gfix to change and gstat to read.
> 
>  
> 
> I want to read it via a sql command. How do that?

  In recent Firebird versions you can query MON$DATABASE table.

Regards,
Vlad



[firebird-support] Re: Slow connection establishment to database

2013-04-24 Thread hvlad


--- In firebird-support@yahoogroups.com, Stefan Heymann wrote:
>
> Hello everybody,
> 
> I had a strange effect on a customer's system today. We usually deploy
> our application with a minimal Firebird client. So the application
> folder contains
>   MyApp.exeand
>   fbclient.dll and a few other application-related files.
> We are using the current incarnation of Firebird 2.5.2.26540, for both
> server and fbclient.
> 
> Usually the app folder is shared (read-only) and people start
> MyApp.exe from their clients. This is easy to set up and works
> perfectly.
>   \\myserver\myapp\MyApp.exe
> 
> The installation today was on a Windows 2008 64-bit server that serves
> as a database server and serves this file share at the same time. When
> we started the application from a client, the program came up
> immediately, but the connection to the database took very long (10 to
> 20 seconds). After that, database communication was fast and normal.
> 
> When I copied the folder to the local client, the connection was
> established immediately. Deactivating virus checks on the server did
> not help.
> 
> When I share the folder *above* my application folder, the connection
> is also established immediately and very fast.
> 
> My suspicion to what is happening here is:
> 
> During connection establishment, fbclient.dll tries to load a file it
> usually finds one level above itself (firebird.conf? firebird.msg?
> firebird.log?)
> 
> As my program starts from the "root" of a Share, there is no parent
> folder, but it takes some time until the OS reports that back (some
> sort of timeout when trying to access \\myserver instead of
> \\myserver\myshare ???) - so I suspect that is what takes so long.
> 
> When the app folder is a sub-folder of the share, fbclient.dll
> immediately finds that empty folder one level up. As it can work
> perfectly without firebird.msg (or whatever it tries to read there),
> everything goes well from there on.
> 
> Can somebody confirm that this is/was the problem?

  I can confirm that fbclient.dll looks for firebird.conf at one folder
above. I don't know why it takes too long but this is something OS (or 
your environment) specific. To avoid it i would try to set FIREBIRD
environment variable to the fbclient folder. It should be done before
fbclient is loaded by application.

Hope it helps,
Vlad



[firebird-support] Re: Does anyone know ExitCode/ErrorLevel values for gfix?

2013-04-10 Thread hvlad


--- In firebird-support@yahoogroups.com, "un_spoken" wrote:
> 
> I will provide one more test for firebird 2.5.2. I have a corrupted base, I 
> will see what gfix says after running it. I think that it should return 1 as 
> an error code. Or atleast error code <> 0.
>

  You think wrong.

  Command line utilities set non-zero exit code if error happens in utility 
itself. So, even for havy corrupted database gfix will not set error code to 
non-zero if server can validate database and API call's returns without errors. 
Because *gfix itself* works without failure.

  Use Service API if you need to know validation result in your application.

Regards,
Vlad



[firebird-support] Re: GUI version of FB Trace Manager (fbtracemgr)

2013-04-08 Thread hvlad
--- In firebird-support@yahoogroups.com, "certfb" wrote:
...
> *Oops*, please disregard the above, yes I do get an isc_info_svc_timeout, 
> sorry and thank you for helping me track this down.

  Good to know :)

Good luck with tracing,
Vlad



[firebird-support] Re: GUI version of FB Trace Manager (fbtracemgr)

2013-04-07 Thread hvlad


--- In firebird-support@yahoogroups.com, "certfb" wrote:
>
> 
> > > The only problem that I have at the moment is that I am using the 
> > > "isc_info_svc_timeout" command as part of a "isc_info_svc_line" 
> > > isc_service_query() but instead of replying with "isc_info_svc_timeout" 
> > > in the header the server replies with "isc_info_svc_line" but a zero 
> > > length data block.
> > 
> >   IIRC, isc_info_svc_line (or isc_info_svc_to_eof) + zero data length means 
> > end of stream and service was stopped at server side.
> 
> This might be my misunderstanding of the "service was stopped at the server 
> side" but after receiving isc_info_svc_line + 0 I continue to receive 
> isc_info_svc_line + valid data as soon some traceable event occurs so I don't 
> think it has stopped?

  Then you should get isc_info_svc_timeout after isc_info_svc_line (with zero 
data). Do you process received buffer up to the isc_info_end ?

Regards,
Vlad



[firebird-support] Re: GUI version of FB Trace Manager (fbtracemgr)

2013-04-07 Thread hvlad


--- In firebird-support@yahoogroups.com, "certfb" wrote:
>
> Hello list!
> 
> I have implemented a very simple GUI version of the bundled trace tool 
> fbtracemgr using wxWidgets.
> 
> If anyone is interested I am more than happy to upload or send them the code.
> 
> If I get the chance I will try to write a blog because some aspects of the 
> trace API take a bit of digging to find the documentation ;)
> 
> The only problem that I have at the moment is that I am using the 
> "isc_info_svc_timeout" command as part of a "isc_info_svc_line" 
> isc_service_query() but instead of replying with "isc_info_svc_timeout" in 
> the header the server replies with "isc_info_svc_line" but a zero length data 
> block.

  IIRC, isc_info_svc_line (or isc_info_svc_to_eof) + zero data length means end 
of stream and service was stopped at server side.

  BTW, fbtracemgr used isc_info_svc_to_eof query, not isc_info_svc_line. The 
latter will produce very low performance.
 
> I looked through the source of fbtracemgr and although I think it expects 
> "isc_info_svc_timeout" it probably doesn't give an error if it doesn't get it.

  Because it is not an error. Errors reported via status-vector :)

> It isn't particularly important because I can just detect 0 length lines (for 
> a normal response even an empty line provides a '\n') but I wondered if 
> anyone has any ideas about this?
>

  Re-read TraceSvcUtil::runService() carefully...

Regards,
Vlad



[firebird-support] Re: fbtracemgr and embedded

2013-03-14 Thread hvlad


--- In firebird-support@yahoogroups.com, Mike Ro wrote:

Mark,

since v2.5 it is possible to use Firebird embedded without install of full CS 
package.
All you need is to create the almost the same folders layout as with full 
Firebird package, including bin, intl, lib, plugin, UDF folders and its 
contents.
Create simlink lib/libfbembed.so.2.5 pointing to the lib/libfbembed.so.2.5.2
Remove not needed binaries from bin folder, if necessary

Set FIREBIRD to the root folder.
Set LD_LIBRARY_PATH to the lib folder (not to the root !)

this is all.

Good luck,
Vlad



[firebird-support] Re: Catching exception fails under isql

2013-03-13 Thread hvlad
--- In firebird-support@yahoogroups.com, "Rick Debay" wrote:
>
> Changing the catch block:
>   WHEN /*GDSCODE unique_key_violation*/ ANY DO
> Allows us to work around the problem.

 This is not a mine deal of course, but this is VERY BAD. Hiding exceptions is 
a *very bad* practice. But this is your code and your life...
 
> > "no current record for fetch" is well-known optimizer bug and in some
> form exists even in latest Firebird versions. Usually it happens when
> one mixed two kind of JOIN syntax (implicit and explicit JOIN's) in the
> same query
> 
> In our case, we're selecting from a stored procedure.

  Which have no statements inside, huh ?

Regards,
Vlad



[firebird-support] Re: Catching exception fails under isql

2013-03-13 Thread hvlad


--- In firebird-support@yahoogroups.com, "Rick Debay" wrote:
>
> I think it's a 1.5 bug, as executing the procedure from DBW also fails

  "no current record for fetch" is well-known optimizer bug and in some form 
exists even in latest Firebird versions. Usually it happens when one mixed two 
kind of JOIN syntax (implicit and explicit JOIN's) in the same query, iirc.

> but works if the stored procedure is stepped through under the DBW
> debugger.

  There is no native debuggers for Firebird. All existing debuggers is 
emulators and can't work exactly same way as engine itself. Also, they have own 
mistakes in implementation. So, don't trust debuggers blindly :)

Regards,
Vlad

PS v1.5 is not developed for a long time, consider upgrade to the more recent 
version...




[firebird-support] Re: fbtracemgr and embedded

2013-03-13 Thread hvlad
--- In firebird-support@yahoogroups.com, "certfb" wrote:
...
> Sorry I should have said that I am using CS 2.5.2 on Ubuntu 12.10.

  It is still not clear which process handle database connection - your 
application's embedded attachment or worker process of Firebird CS.

> I have set up fbtracemgr to use fbemded by setting the following environment 
> variables:
> 
> export FIREBIRD=/home/myhome/experiments/firebird
> export LD_LIBRARY_PATH=/home/myhome/experiments/firebird

  If you already have properly installed and worked CS you should not change 
environment variables.
 
> I have tried putting libfbtrace.so in $FIREBIRD, $FIREBIRD/plugins and even 
> tried /opt/firebird/plugins
> 
> but fbtracemgr cannot find the plugin, "Can not start trace session. There 
> are no trace plugins loaded"

  Don't change environment, make sure your account is a member of a "firebird" 
group and all should work without additional steps.

Regards,
Vlad

PS The guide you are referring to is *very* outdated and describes FB 1.5.



[firebird-support] Re: Catching exception fails under isql

2013-03-10 Thread hvlad


--- In firebird-support@yahoogroups.com, "Rick Debay" wrote:
>
> Does anyone have any insight in to this?
> 
> Running this statement in isql:
> 
>   EXECUTE PROCEDURE P_IMPORT;
> 
> Yields this error:
> 
>   Statement failed, SQLCODE = -508
>   no current record for fetch operation
>   -violation of PRIMARY or UNIQUE KEY constraint

  I'd said the error is not "violation of PRIMARY or UNIQUE KEY constraint" but 
"no current record for fetch operation". 
I don't know why second (wrong) part is there...

Regards,
Vlad



[firebird-support] Re: fbtracemgr and embedded

2013-03-10 Thread hvlad


--- In firebird-support@yahoogroups.com, "certfb" wrote:
>
> Hi,
> 
> Sorry for the (possibly) silly question, but is it possible to use fbtracemgr 
> with the embedded server?

  Yes
 
> If so what should the 'connect' string look like, i.e. in...
> 
> fbtracemgr -SE remote_host:service_mgr -USER SYSDBA -PASS masterkey -LIST
> 
> ...what would I replace the 'remote_host:service_mgr' with?

  If you want to trace "local" database, just use "service_mgr" and ensure 
fbtracemgr used fbembed[.dll|.so] instead of fbclient.

Regards,
Vlad



[firebird-support] Re: Firebird, IBReplicator, or Windows Permissions?

2013-02-26 Thread hvlad
--- In firebird-support@yahoogroups.com, "Carlos H. Cantu" wrote:
>
> h>   Don't use WNET connection strings, especially on Win7.
> 
> I never use WNET, but I'm curious: why not?

  And why yes ? :)

Not, because:
a) NetBEUI is deprecated by MS since WinXP (iirc)
b) it requires additional security tuning
c) it is not recommended for networks with more than few 10th of hosts
d) it not allows more that 255 attachments, by design of WinAPI
is it enough ? ;)



[firebird-support] Re: Firebird, IBReplicator, or Windows Permissions?

2013-02-25 Thread hvlad


--- In firebird-support@yahoogroups.com, "Justin"wrote:
...
> Extract from C:\\ProgramData\IBPReplicator\Replicate.log:
> 
> 02/23/13 10:48:39: *** Start Replication
> 
> Replicate BOX3->BOX4, BOX3 -> BOX4
> 02/23/13 10:48:49: Connected to DB: \\BOX3\C:\Program
> Files\Solution\Database\Solution.fdb
> 02/23/13 10:48:49: Connected to DB: \\BOX4\C:\Program
> Files\Solution\Database\Solution.fdb
> 02/23/13 10:54:07: Error (id "TFBDB::ExecuteSelect - execute") happen
> during execution of schema BOX3->BOX4 (BOX3 -> BOX4)
> Update MESSAGEHISTORY 301946
> Unable to complete network request to host "BOX3".
> Error reading data from the connection.
> The specified network name is no longer available.
> Unsuccessful execution caused by a system error that precludes
> successful execution of subsequent statements
> Replicate BOX4->BOX3, BOX4 -> BOX3
> 02/23/13 10:54:07: Disconnected from DB: \\BOX4\C:\Program
> Files\Solution\Database\Solution.fdb
> 02/23/13 10:54:07: Connected to DB: \\BOX4\C:\Program
> Files\Solution\Database\Solution.fdb
> 
> Extract from C:\\Program Files\Firebird\Firebird_2_1\Firebird.log:
> 
> C:\Program Files\Firebird\Firebird_2_1>tail firebird.log
> tail v1.30 (c) Greg Robson-Garth, 1998-2001
> 25:07 2013
> WNET/wnet_error: WriteFile errno = 64
> 
> BOX4 (Client) Sat Feb 23 10:30:55 2013
> WNET/wnet_error: WriteFile errno = 64
> 
> BOX4 (Client) Sat Feb 23 10:30:55 2013
> WNET/wnet_error: WriteFile errno = 64
> 
> BOX4 (Client) Sat Feb 23 10:30:55 2013
> WNET/wnet_error: WriteFile errno = 64
> 
> BOX4 (Client) Sat Feb 23 10:32:07 2013
> WNET/wnet_error: CreateFile errno = 64
> 
> C:\Program Files\Firebird\Firebird_2_1>

  Don't use WNET connection strings, especially on Win7. 

Change 
  \\BOX3\C:\Program Files\Solution\Database\Solution.fdb
by 
  BOX3:C:\Program Files\Solution\Database\Solution.fdb

And do the same for BOX4.

Regards,
Vlad



[firebird-support] Re: Error "error while compiling regular expression" while using TraceAPI

2013-01-31 Thread hvlad



--- In firebird-support@yahoogroups.com, Jiri Cincura  wrote:
>
> On Thu, Jan 31, 2013 at 11:15 AM, hvlad  wrote:
> > Why do you omit first lines of trace configuration ?
> 
> Yahoo did that. You can see it at http://pastebin.com/K2zV4KZx .

  Strange, but anyway
 
> > I assume you use pattern for database name.
> 
> Actually now. Just the full path.

  Please, read carefully comments at fbtrace.conf:

# Pattern is either database name without path or "SIMILAR TO"-based regular
# expression which is matched against fully qualified database path name.

Double every slash in your database name pattern and all will be OK

Regards,
Vlad



[firebird-support] Re: monitoring firebirdsql with opensource tool ?

2013-01-31 Thread hvlad


--- In firebird-support@yahoogroups.com, Svein Erling Tysvær  wrote:

> I use Fb 2.5 

  Wow ! Finally ! You are migrated from FB 1.5 ? 

Congratulations !
Vlad





[firebird-support] Re: Error "error while compiling regular expression" while using TraceAPI

2013-01-31 Thread hvlad





--- In firebird-support@yahoogroups.com, Jiri Cincura  wrote:
>
> Just in case the trace configuration is:
> 
> enabled true
> log_connections true
> connection_id 0

  Why do you omit first lines of trace configuration ? I assume you use pattern 
for database name. In this case, by the rules of regular expressions, you 
should double escape character embedded in search pattern. And escape character 
is '\', of course ;)


Regards,
Vlad



[firebird-support] Re: Firebird 2.5 performance slower then 2.1 especially SuperClassic...

2012-08-01 Thread hvlad


--- In firebird-support@yahoogroups.com, "randallsell" wrote:
>
> Hello all,
> 
> I recently upgraded FB from 2.1.5 to 2.5.1. In order to port data we 
> essentially write the contents of the database to a file, then read it back 
> in again. In short, this amounts to many thousands of INSERT statements. (Yes 
> I know how to use GBak, this process was designed to make metadata mods easy).
> 
> Anyway, this process has been working nicely for many years, and I expected 
> that the performance of 2.5 would be more or less on par with 2.1, possibly 
> better (SMP, SuperClassic). But it isn't. In fact it ranges from 25% worse to 
> 4x worse (400%). So I thought I'd raise the issue. I'm sure a bunch of 
> nay-sayers will argue that my tests are invalid, blah blah. 

  Don't ask people if you don't like answers. Easy, isn't is ? :-D

> But rest assured I ran my tests many times over on the same machine to ensure 
> the results are accurate. And the only things varied in the tests were the 
> backend server version / architecture / Forced-Writes. Front-end app and 
> import file always the same.
> 
> Here are the results of the import runs:
> 
> FB 2.1.5 SuperServer Force-Writes Off 3 min 40 sec
> FB 2.1.5 SuperServer Force-Writes On 7 min 15 sec
> 
> FB 2.5.1 SuperServer Force-Writes Off 4 min 30 sec
> FB 2.5.1 SuperServer Force-Writes On NOT TESTED
> 
> FB 2.5.1 SuperClassic Force-Writes Off 17 min 35 sec
> FB 2.5.1 SuperClassic Force-Writes On 20 minutes 4 seconds
> 
> So a pure upgrade from 2.1 to 2.5 (same SuperServer architecture) made the 
> process 25% slower (looking at Forced Writes Off only). The real killer above 
> is the new SuperClassic architecture. 

  SC (like CS) have very small page cache by default. If your tables have few 
active indices during INSERT's it will be very slow because of small page cache.

  Or compare 2.1 CS against 2.5 SC\CS, or set page cache value equal for all 
tests.

Regards,
Vlad



[firebird-support] Re: The worst day i can have with firebird

2012-07-07 Thread hvlad
--- In firebird-support@yahoogroups.com, Jesus Garcia wrote:
>
> Two days ago, we moved from one server with interbase 2009 windows 2003 and
> 4 Gb RAM to Firebird 2.5.2 Superclassic, 16 Gb RAM
> The database is around 21 Gb, and yesterday seems all was running fine.
> 
> Today, i have checked Firebird.log and i have seen that there is an error
> of type
> 1296554 page type 4 lock denied (216), and page type 4 lock denied in
> another page, that are logged from .
> 
> viewing monitoring tables, i have seen on transaction  opened for 4 hours,
> and i have tried to delete de attachment. When i have deleted it, firebird
> has crashed and around 130 users has been dropped. After that in
> Firebird.log, i see no information about the crash, and i don't know what
> can happen, and what to do, and where look up for the reason of the problem.

  Tune OS to produce crash dumps. 

> After that crash, I see in the log page 1296554, page type 4 lock
> conversion denied (215), and don'n know what to do with this errors.
> 
> Another problem is that transactions_id jumps, 2, and 3 in one
> minute.

  This is your starting point - find why it "jumps", fix it and you'll never
see "lock conversion denied" errors like above.

Regards,
Vlad



[firebird-support] Re: Firebird hangs for a while blocking all DB operations periodically.

2012-06-14 Thread hvlad
--- In firebird-support@yahoogroups.com, "anthonyjang2012" wrote:
>
> Vlad,
> 
> We have emailed a link to download the mini-dump and lock-print. 

  Just answered to you privately.

> Please let us know if this is helps to resolve the issue 

  Sure.

Regards,
Vlad



[firebird-support] Re: Firebird hangs for a while blocking all DB operations periodically.

2012-06-12 Thread hvlad


--- In firebird-support@yahoogroups.com, "anthonyjang2012" wrote:

> The issue occurred again, but, unfortunately, we only obtained a full dump. 
> The full dump is 8GB (1GB zipped). Would this be useful to send to you? 
> Please let me know so that I can put it on an ftp site for you to download. 
> Unfortunately, we did not obtain a mini-dump.

  Are you able to extract stack traces for every thread ? If yes, extract them 
into text file and send to me. Else send me the link
to the ftp with full dump.

Vlad

PS Very sad you have no mini-dump. 



[firebird-support] Re: TempDirectories and ALTER INDEX ACTIVE

2012-06-10 Thread hvlad


> It might be worth to investigate this tradeoff, or just to provide an 
> option to rebuild indices without using temporary sort spaces so others 
> can measure it for themselves (or to have a workaround if disk space is 
> not large enough to accommodate the rebuild).

  You already can do it by yourself. Run and compare

1. good and fast 
- create table
- insert a lot of records
- create index

and

2. bad and slow
- create table
- create index
- insert a lot of records

Regards,
Vlad



[firebird-support] Re: URGENT: Invalid request BLR

2012-06-10 Thread hvlad
--- In firebird-support@yahoogroups.com, Alec Swan wrote:

> What can you expect if Firebird needs temporary disk space which isn't
> > available to create/activate an index?
> >
> 
> I expect the statement to fail but but not corrupt the state of the
> database. Similarly to how a query with a large sort would fail if there is
> not enough disk space for the temporary sort file and doesn't corrupt the
> database.

  And what kind of corruption happens in your case ?

Regards,
Vlad



[firebird-support] Re: TempDirectories and ALTER INDEX ACTIVE

2012-06-08 Thread hvlad


--- In firebird-support@yahoogroups.com, Alec Swan wrote:

> My main question is how can we calculate the temp sort space required
> to ALTER INDEX ACTIVE (on all indexes serially) given the size of the
> database? Is twice the size of the database a good upper bound? 

  Enumerate all fields in index, calculate summa of full size of every 
field (for [var]char(N) it is N * bytes_per_char, for ex.), add extra 8 
bytes (for record number) - this is sort record size. 
  Multiply it by number of records and you'll get a lower estimate of 
temp space required. Substract value of TempCacheLimit and you'll get 
estimate of disk space required.

Regards,
Vlad



[firebird-support] Re: Server

2012-06-08 Thread hvlad
--- In firebird-support@yahoogroups.com, "Michael Vilhelmsen" wrote:
>
> Ah - you are right :)
> Its the amount of start/commit I was referring to. My bad.
> 
> Statistics are as of now:
> 
> Database "E:\DB\OCCeasyPos.Fdb" 
> Database header page information: 
>   Flags   0 
>   Checksum12345 
>   Generation  55467812 
>   Page size   4096 
>   ODS version 11.1 
>   Oldest transaction  54691256 
>   Oldest active   55360946 
>   Oldest snapshot 55360946 
>   Next transaction55467714 

  Next - OIT = 776458, i.e. every snapshot (concurrency) transaction requires 
~192KB for private TIP snapshot. Also, at transaction start, it should read 48 
TIP pages to build that private TIP snapshot.

  You should sweep database fromt time to time to "unstuck" OIT.

  Look also at Next - OAT = 106768, it show that there are long running 
transaction(s) present. Look at MON$TRANSACTION for tx 55360946 to see what is 
it and fix application which was started it.

Good luck,
Vlad



[firebird-support] Re: Embedded Firebird leaves a lot of temp files behind

2012-06-03 Thread hvlad


--- In firebird-support@yahoogroups.com, Alec Swan wrote:
>
> Vlad, the large files have fb_sort prefix. But we also see a lot of small
> fb_lock files.

  They could be left only if engine was not shutted down correctly. 

  fb_sort_XXX files left means application was crushed. 

  fb_lock_XXX files are per database and will be reused at next connect. 
I don't think it is an issue unless you works with different databases 
every time. Note, since v2.5 Firebird embedded doesn't put lock files
into temp folder, so this files was left by another embedded Firebrid 
version.

  Make sure you close all attachments before program exits. It would be 
the best if you call fb_shutdown() before exit. Also, you can cleanup 
that files at your program startup before first call of ISC API.

> Lester, we are a Windows-based shop and most of our customers have FB
> databases are under 200MB. There are just a few that have 10-20GB databases.
> 
> Our customers need the ability to put those files on a separate disk and
> restrict their cumulative size. TempDirectories setting would have been
> perfect for it, but I can't get it to work with embedded Firebird.
> 
> If its is supposed to work in embedded mode then I will spend more time
> making sure that I am not doing something wrong before taking any more of
> your time.

  It must work. Sooner of all engine can't find firebird.conf. For v2.5 it 
should be placed at the same folder as fbembed.dll. 

Regards,
Vlad



[firebird-support] Re: Embedded Firebird leaves a lot of temp files behind

2012-06-03 Thread hvlad


--- In firebird-support@yahoogroups.com, Alec Swan wrote:
>
> Hello,
> 
> Our customers are complaining that there are lots of (GBs) temp files
> written by Firebird in temp directory. 

   Does names of that files have common prefix ?
What OS (Windows, i guess)?

Regards,
Vlad



[firebird-support] Re: Firebird hangs for a while blocking all DB operations periodically.

2012-05-30 Thread hvlad
--- In firebird-support@yahoogroups.com, "anthonyjang2012" wrote:
>
> How do we take a memory dump from the fb_inet_server process? 

  There are a lot of tools to do it, starting from task manager (since vista), 
userdump and process explorer (my favorite tool)

Regards,
Vlad



[firebird-support] Re: Firebird hangs for a while blocking all DB operations periodically.

2012-05-30 Thread hvlad
--- In firebird-support@yahoogroups.com, "anthonyjang2012" wrote:
>
> Environment : Firebird 2.5.1 Super-Classic x64 on Windows 2008 R2 Server with 
> 32 GB of RAM
> 
> We have a Firebird server installation that periodically blocks all 
> operations for a few minutes and then comes back alive on its own. This has 
> happened about once a month for the last few months. During this blocking 
> period, Firebird CPU usage is unusually low as this is a busy server. This 
> server normally has 200-300 client attachments. The blocking time has varied 
> from 2 minutes to over 10 minutes. During this time, no Firebird operations 
> can be performed i.e. New connections are blocked along with existing 
> connections. Upon recovery, Firebird continues processing without any other 
> issues. 
> 
> We have noticed that this has generally occurred, but not always, during a DB 
> sweep. Our sweep interval is set to 0 and we are performing the sweep once a 
> day as a scheduled task.

  When\if it occurs next time, please, take two memory dumps (one is fulldump 
and second is minidump) from fb_inet_server process and send minidump to me for 
analyze.

Regards,
Vlad



[firebird-support] Re: building a DLL and trying to use gcc

2012-04-30 Thread hvlad


--- In firebird-support@yahoogroups.com, Ray Holme wrote:

> I said it was C not C++ and I said that I use ibase.h and ib_util.h to
> define the two routines, but I should also say that my gcc compile line
> specifies "-DWIN32" so the functions would be declared
> 
> extern void __stdcall isc_decode_date(...)
>   and
> extern void * isc_util_malloc(...)
> 
>   the latter should probably have been declared:
> 
> extern void * ISC_EXPORT isc_util_malloc(...)
>   in ib_util.h but is not
>   (I do put in the __stdcall for ALL my udf functions)
> 
> Despite that I do not match and find the routines in the two libraries.

  I understand almost nothing in above. But it seems you used wrong
declarations of isc_decode_date and isc_util_malloc. Could you prepare
and show minimal code sample and commands you used to build a library ?

Regards,
Vlad



[firebird-support] Re: LEFT OUTER JOIN is extremely slow.

2012-04-30 Thread hvlad


--- In firebird-support@yahoogroups.com, "jankowalsky825" wrote:
>
> Hi guys.
> 
> I've read whatever I could find about this problem. Suggestion is to create a 
> proper indices and that should speed up the query but query optimizer do not 
> take my indices into account and generates natural plan. I do not know what 
> should I do?
> 
> Here are my two tables:
> 
> CREATE TABLE CLIENT
> (
...
>   SYMFONIANUMBER varchar(255) CHARACTER SET WIN1250 COLLATE PXW_PLK,
...
> );
...
> CREATE INDEX CLIENT_SYMFONIANUMBER_A ON CLIENT (SYMFONIANUMBER);
...
> CREATE GLOBAL TEMPORARY TABLE IMPORT_TEMP_LOCATION
> (
...
>   CLIENT_OUTID integer,
...
> )
> ON COMMIT PRESERVE ROWS;
...
> In CLIENT table I have 167502 rows and in IMPORT_TEMP_LOCATION I have 203 
> rows and it takes 1:30 minutes to execute my query.
> 
> SELECT C.ID_CLIENT FROM IMPORT_TEMP_LOCATION T
> LEFT OUTER JOIN CLIENT C ON (T.CLIENT_OUTID = C.SYMFONIANUMBER)

  You are joining INTEGER with VARCHAR. It couldn't use index for such 
condition.
You can :
- change type of CLIENT_OUTID to VARCHAR, or 
- change type of SYMFONIANUMBER to INTEGER, or
- CAST(CLIENT_OUTID AS VARCHAR) in join condition (if it makes sence for your 
data)

Regards,
Vlad



[firebird-support] Re: building a DLL and trying to use gcc

2012-04-29 Thread hvlad






> --here is a try using the lib files
>  
> gcc -shared -o vetAdmin.dll udf.o fbclient_ms.lib ib_util_ms.lib
> -Wl,--export-all-symbols -Wl,--enable-auto-import
>  
> udf.o:udf.c:(.text+0x1ce): undefined reference to `isc_decode_date@8'
> udf.o:udf.c:(.text+0x205): undefined reference to `ib_util_malloc'
> collect2: ld returned 1 exit status

  How does you declare isc_decode_date and ib_util_malloc in your code ? Does 
you used C++ or C compiler ?

Regards,
Vlad



[firebird-support] Re: Why it's soo slow ? it's just a very simple select ...

2012-03-10 Thread hvlad
--- In firebird-support@yahoogroups.com, "nathanelrick" wrote:
>
> OK, thanks...
> 
> so it's confirm :
> 
> 1/ try to avoid table with big number of fields (mostly try to make the size 
> of a record (size used by all fields) more little as possible)

  Nope. It is the same as if you going to avoid tables with big number of rows.

> 2/ try to use a pool of parametized statement (read only read commited)... 
> because here it's only the prepare that is slow

  Re-use of prepared statements is a way to go, definitely. And it not depends 
on tx isolation level.

> 3/ try to use bigger page size (16k?)

  It will reduce number of PP's, yes. But it could make writes slower, so you 
need to evaluate it first on your load.

> but just want to know if in the background, in the engine, nothing can be 
> done in the c++ code to ameliorate this behavior of the prepare

  We hope that whole statistics subsystem will be reworked in v3.

Regards,
Vlad



[firebird-support] Re: Why it's soo slow ? it's just a very simple select ...

2012-03-10 Thread hvlad
--- In firebird-support@yahoogroups.com, "nathanelrick" wrote:
>
> >   Just run this query and show us results:
> > 
> > SELECT R.RDB$RELATION_NAME, COUNT(*)
> >   FROM RDB$PAGES PG JOIN RDB$RELATIONS R
> > ON PG.RDB$RELATION_ID = R.RDB$RELATION_ID
> >  WHERE PG.RDB$PAGE_TYPE = 4
> >AND R.RDB$RELATION_NAME IN ('DESC_VARCHAR', 'DESC_EMPTY')
> > GROUP BY R.RDB$RELATION_NAME
> 
> DESC_BLOB: 1872
> DESC_EMPTY: 135
> DESC_VARCHAR: 2166
> 
> 
> >   Also, could you repeat the test using bigger page cache, say > 1200 pages 
> > ?
> 
> With page buffer to 1200 pages, nothing change too much, but with a buffer of 
> around 3000 page yes stat become to be better (but not for the first select, 
> we need to do several select to see the speed go down, i thing the time to 
> read the page from disk to the cache)

  Well, it fully explains the issue. When Firebird prepared the query it 
calculates
estimate number of rows in relation. To do it, engine reads all pointer pages
and calculate number of data pages in relation. So, to fix your issue, it is 
enough
to use prepared queries as already was suggested here.

  Large page cache allows to cache all PP's after first read and demonstrate
that conclusion above is correct. I don't offer you to set big page cache
at worker machine, it was needed just for confirmation.

Hope this helps,
Vlad



[firebird-support] Re: Why it's soo slow ? it's just a very simple select ...

2012-03-09 Thread hvlad


--- In firebird-support@yahoogroups.com, "David Hollings" wrote:
...
> Conclusion:
> 
> Baffled why a select (which could never possibly return a result) reads
> ~1150 pages from DESC_VARCHAR but only ~230 pages from DESC_EMPTY given that
> the two indices on IDOBJ columns are virtually identical (identical data,
> identical fills etc).

  Could you, please, count numbers of pointer pages for both relations, please ?

  Just run this query and show us results:

SELECT R.RDB$RELATION_NAME, COUNT(*)
  FROM RDB$PAGES PG JOIN RDB$RELATIONS R
ON PG.RDB$RELATION_ID = R.RDB$RELATION_ID
 WHERE PG.RDB$PAGE_TYPE = 4
   AND R.RDB$RELATION_NAME IN ('DESC_VARCHAR', 'DESC_EMPTY')
GROUP BY R.RDB$RELATION_NAME


  Also, could you repeat the test using bigger page cache, say > 1200 pages ?

Regards,
Vlad





[firebird-support] Re: Problem with UDF when migrating from 2.1 to 2.5

2012-01-06 Thread hvlad
--- In firebird-support@yahoogroups.com, Marcin Bury wrote:
...
> File FreeUDFLib.dll is placed in UDF directory
...
> The new server version is: LI-V6.3.1.26351 Firebird 2.5 running on 
> CentOS Linux...
> 
> Any clues?

  dll on Linux, oh man...

Regards,
Vlad



[firebird-support] Re: table insert into itself - can this be done?

2011-12-15 Thread hvlad
--- In firebird-support@yahoogroups.com, Ann Harrison wrote:

> Trust the right side, Luke.  Maybe someone has fixed this in a more
> recent version of Firebird, but it's a
> characteristic bug of databases that Jim Starkey writes.  Unless
> there's a sort (e.g. order by, distinct,
> grouped) they get records one a time rather than finding all
> qualifying rows first as the standard anticipates.
> Rdb/Eln, InterBase, Firebird, Netfrastructure, Falcon, and, until
> recently NuoDB all go into an infinite loop
> if you have any rows in table A an do something like this:
> 
>  insert into A select * from A
> 
> Retrieving all the rows and data first is really inefficient.
> Retrieving the rows and retaining only the db-keys
> (or equivalent) does the same amount of I/O as retrieving data first,
> but doesn't use as much memory or
> temporary disk space.  The solution that NuoDB implemented is to keep
> a sparse bitmap of the db-keys of
> the inserted records and not reinsert them when they come back from
> the select.  

  But this way updates and deletes are not addressed. Probably NuoDB's
implementation is more complex than just bitmap of inserted record 
numbers and really addressed all cases of unstable cursor...

> Note that db-keys are not
> necessarily monotonically increasing, so the query has to run until it
> exhausts the result set, not just stop
> when it finds the first "new" record.   And, of course, you can't just
> ignore records created by your transaction,
> or running the query twice wouldn't get the right answer.
> 
> It's possible to do the same thing using the information in the
> savepoint undo list, I think, and maybe
> Firebird implemented that after 2.0.

  Yes, it is done in FB3 (still pre-alpha)

Regards,
Vlad



[firebird-support] Re: unreproducable crash of Fbserver.exe

2011-11-28 Thread hvlad
--- In firebird-support@yahoogroups.com, "kittikira" wrote:
>
> Hello,
> 
> I allready postet this to the firebird tracker, but did not get any
> response from there. For it is an urgent problem, I hope I find some
> help here.

  What is the ticket number ?

Regards,
Vlad



[firebird-support] Re: Log file size and information regarding entry

2011-11-28 Thread hvlad


--- In firebird-support@yahoogroups.com, "Michael Vilhelmsen" 
 wrote:
>
> 
> The log file contains 42.609.189 lines.
> around 41.000.000 og those are this
> 
> DBSRV02 (Server)  Sat Nov 19 12:46:06 2011
>   INET/inet_error: accept errno = 10038
> 
> 
> DBSRV02 (Server)  Sat Nov 19 12:46:06 2011
>   INET/select_wait: found "not a socket" socket : 472

  If you used Firebird events, than it looks like CORE-3119, fixed in FB 2.1.4 
(you have 2.1.3)

Regards,
Vlad



[firebird-support] Re: Does Firebird expose the db wide 'row version'?

2011-10-10 Thread hvlad


--- In firebird-support@yahoogroups.com, "samcarleton" wrote:
>
> 
> 
> --- In firebird-support@yahoogroups.com, "fernnaj"  wrote:
> >
> > Hello,
> > 
> > I had the same question time ago, and I posted at MS Forums - please have a 
> > look at my post at 
> > http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/102fd11e-d7ce-479e-a07b-b2e836f3f87e
> >  - at the end min_active_rowversion is what we use.
> 
> Fernando,
> 
> That is EXACTLY the situation I am predicting.  In the post you stated 
> "Finally I opted to implement #2, as Firebird does have the same concept", 
> can you give me a bit more info on how to do it in Firebird?  

  I doesn't fully read how MS Sync FW works but if you need to mark every 
inserted\updated record by increased number, generated at commit time, you can :
a) add TranNum field to the all interesting tables
b) fill this field in BEFORE INSERT OR UPDATE trigger using CURRENT_TRANSACTION 
value
c) create special table like TranMarks(TranNum, TranMark)
d) create sequence SeqTranMarks
e) create ON COMMIT database trigger which will insert CURRENT_TRANSACTION and 
next value of sequence SeqTranMarks into TranMarks table

Now you have marked all records by transaction numbers and order of 
transaction's commits.

Hope this helps,
Vlad



[firebird-support] Re: Firebird database is slow (?)

2011-09-30 Thread hvlad


--- In firebird-support@yahoogroups.com, "cruvadom" wrote:
>
> Hi all,
> I have a IBExpert client querying Firebird 2.5 server via tcp/ip over WAN. 
> I'm making a simple query on the client side for an indexed table containing 
> 2 columns and 4 rows (very small).
> overall time until data is shown is around 10 seconds.
> Prepare time is around 3 sec, execution is around 200 ms. 
> same query locally (client on the same machine as server) takes 1 ms to 
> process.
> is it normal? I think too slow. any ideas?
> 
> Thanks, 
> Gil.
> 
> IBExpert data about the query:
> Plan
> PLAN (AmazonCategories NATURAL)
> 
> -- Performance info --
> Prepare time = 2s 839ms
> Execute time = 218ms

  IBE is *very* ineficient application on slow lines. Try isql.

> My settings:
> Firebird SuperServer 2.5 (on win xp sp2)
> Latest IBExpert on client side. (win7)

  Make sure you have fbclient v2.1 at least.

> No firewall
> ping from client to server is around 190 ms.

  This is well correlated with execution time (218 ms).

> server can't reach client with ping (weird, but I don't think matters)

  Yes, it doesn't matters.

  With roundtrip time 190 ms you can't expect fast response not from Firebird, 
nor from any other client-server system which makes many roundtrips. 

Regards,
Vlad



[firebird-support] Re: Shutdown engine with an exception inside a udf dll

2011-09-11 Thread hvlad
  Jesus and Karol, 

it is better to go to fb-devel with this subject, i think.

Regards,
Vlad



[firebird-support] Re: FB 2.5.0 and field default value containing '%'

2011-09-10 Thread hvlad
--- In firebird-support@yahoogroups.com, "a.casati" wrote:
>
> Hello. I did a gbak of a 2.1.4 DB.
> One field is a varchar(128) with default value '%t n° %n del %d'.
> I get an error restoring it with 2.5.0: "Invalid metadata detected".
> Is it caused by the "%" character? How can I resolve this issue?

  Read release notes. Always read release notes.
Search for new gbak switches (fix_fss_XXX).

Regards,
Vlad



[firebird-support] Re: Shutdown engine with an exception inside a udf dll

2011-09-08 Thread hvlad


--- In firebird-support@yahoogroups.com, Jesus Garcia wrote:
>
> Hello, is normal to crash the engine whe an exception is raised inside a udf 
> dll or must be catch by the engine?

  Any kind of exception *must* be handled inside UDF.
 
> I had a udf with the function power. If i call power with a negative valué 
> in the base parameter an exception is raised and the engine is stopped. Why 
> not catch the exception To prevent the problem and raise it like any 
> exception?

  Because of a lot of reasons. 
Different models of exception handling in different compilers of different 
languages and different OS'es. 
Run-time performance overhead. 
Etc, etc, etc...
 
> I think this is a bug in the engine.

  Nope.

Regards,
Vlad



[firebird-support] Re: Merge results of recursive CTE with results of non-recursive CTE

2011-08-31 Thread hvlad
--- In firebird-support@yahoogroups.com, Nols Smit wrote:

> Now I wondered if it's possible to have one block of executable SQL?

  It depends on what do you call as "one block of executable SQL".

Regards,
Vlad



[firebird-support] Re: Merge results of recursive CTE with results of non-recursive CTE

2011-08-31 Thread hvlad
--- In firebird-support@yahoogroups.com, Nols Smit wrote:
>
> Hi,
> 
> 
> Is it possible to merge results of a recursive CTE with the results of a 
> non-recursive CTE?
> 
> I seems one can not have one executable block of SQL containing both.
> 
> Typically I use a non-recursive CTE to filter data for the main table, 
> referencing many lookup tables.  However, two of the lookup tables are 
> tree-structures.  If I filter data using only one tree-structure (as a lookup 
> table) then a recursive CTE is easy to use but I can not figure out how to 
> use a combination in one executeable block of SQL.

  Not sure i understand you correctly, but... did you tried to create query 
with more that one CTE ? :)

  I.e. something like

WITH RECIRSUVE
  cte1 as (...), // 1st recursive cte
  cte2 as (...), // 2nd recursive cte
  cte3 as (...)  // non-recursive cte

SELECT ... 
  FROM cte1 JOIN cte2 ON ... JOIN cte3 ON ...

Regards,
Vlad



[firebird-support] Re: error in firebird.log

2011-08-23 Thread hvlad


--- In firebird-support@yahoogroups.com, Nick Upson wrote:
>
>  ISC_kill: process 17382 couldn't deliver signal 16 to process 17918:
> permission denied
> 
> 
> running 2.1.4 CS on Centos, anyone understand it?

  You have few engine processes running by different users. For example, 
regular working processes (by user "firebird") and isql or gbak using embedded 
engine (by interactive user).

Regards,
Vlad



Re: [firebird-support] Deploying Multiple Applications That Use Firebird 2.5 Embedded Databases.

2011-08-17 Thread hvlad
--- In firebird-support@yahoogroups.com, Iwan Cahyadi Sugeng wrote:
>
> Hmm interesting info helen, so the embeded server will work mostly like the
> super server.

  No ! Embedded in v2.5 is based on SuperClassic architecture.

> so what is the performance impact by using embeded server this
> way.i meant if multiple apps accessing multiple or single database?

   None. 

Regards,
Vlad



[firebird-support] Re: Deploying Multiple Applications That Use Firebird 2.5 Embedded Databases.

2011-08-17 Thread hvlad
--- In firebird-support@yahoogroups.com, Helen Borrie wrote:
...
> Actually, with v.2.5, you can separate the embedded Firebird components from 
> the application components when you deploy.  If you wish to have the three 
> applications all use the same Firebird components, you can do so with 2.5, by 
> deploying fbembed.dll and all the Firebird stuff into a common location 
> *apart* from the application executable.  Set the RootDirectory in 
> firebird.conf to be the path to where fbembed.dll is.  

  The last step is not necessary. I.e. you don't need to change RootDirectory 
if all Firebird components are near fbembed.dll.

Regards,
Vlad