Geoserver executes sql twice & queries number of rows - geoserver

two issues with Geoserver - probably someone has experience of these...
1. SQL statement executed twice
I can see from Geoserver logs that the SQL is executed twice. This happens for all the layers and in several environments. Why ??
Here is the snapshot from my log file (actual sql hidden of course):
2022-06-27 08:57:40,366 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2022-06-27 08:57:40,448 DEBUG [org.geotools.data.jdbc] - exporting PropertyName
2022-06-27 08:57:40,452 DEBUG [org.geotools.jdbc] - SELECT count(*) AS gt_result_ FROM (SELECT * ......
Request: getFeature
service = WFS
version = 2.0.0
baseUrl = http://localhost:8085/geoserver/
outputFormat = application/json
resolve = none
resolveDepth = *
resolveTimeout = 300
resultType = results
2022-06-27 08:57:40,648 INFO [org.geoserver.wfs.json] - about to encode JSON
2022-06-27 08:57:40,650 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2022-06-27 08:57:40,888 DEBUG [org.geotools.data.jdbc] - exporting PropertyName
2022-06-27 08:57:40,888 DEBUG [org.geotools.jdbc] - SELECT "GEOLOC".ST_AsBinary() as "GEOLOC",...
2022-06-27 08:57:41,566 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2022-06-27 08:57:41,568 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2022-06-27 08:57:41,713 DEBUG [org.geotools.data.jdbc] - exporting PropertyName
2022-06-27 08:57:41,714 DEBUG [org.geotools.jdbc] - SELECT "GEOLOC".ST_AsBinary() as "GEOLOC",...
2022-06-27 08:57:42,146 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2022-06-27 08:57:42,159 INFO [org.geoserver.flow] - releasing flow controllers for [WFS 2.0.0 GetFeature]
2022-06-27 08:57:42,159 INFO [org.geoserver.flow] - Request completed, running requests: 0, blocked requests: 0
2. How to remove "select count(*)..."
Geoserver executes always "Select count(*) ..." in order to find out how many rows is to be fetched. How to prevent this? I read that "Skip the counting of the numberMatched attribute" (in layer > publishing) would do the trick but it does not help.

Answering myself...
1. SQL statement executed twice
The reason was parameter "return bounding box with every feature" in Geoserver WFS settings. I got rid of double execution by unchecking this
2. How to remove "select count(*)..."
Looks like using WFS 1.0.0 is the only solution for this

First time the features are counted here. No way to skip.
Second time the features are counted here. That can be skipped by checking "NumberMatched skip" on the WFS layer settings.
Perhaps putting an index on the table will help with performance of the query.

Related

Log incoming time of request in Quarkus

I would like the log to mention something whenever an incoming request reaches the server, so that I can see its exact time of entry.
Rationale is that I would like to see and follow in the log what happens to the request, from its incoming time up to the response time, so that I can see where the time is spent, in order to take decisions relating to optimisation.
This is on a local server used only for such debug activity, so there would be only one request at a time.
Here is an example (partial) log from the moment a request comes.
Hibernate:
select
user0_."id" as id1_6_
from
"User" user0_
where
(…)
2021-12-20 01:35:43,545 TRACE [org.hib.typ.des.sql.BasicBinder] (executor-thread-192) binding parameter [1] as [VARCHAR] - (…)
Hibernate:
select
(…)
2021-12-20 01:35:43,735 TRACE [org.hib.typ.des.sql.BasicBinder] (executor-thread-192) binding parameter [1] as [INTEGER] - [2]
Hibernate:
select
user0_."id" as id1_6_0_,
(…)
2021-12-20 01:35:44,275 TRACE [org.hib.typ.des.sql.BasicBinder] (executor-thread-192) binding parameter [1] as [VARCHAR] - (…)
2021-12-20 01:35:44,655 INFO [io.git.oli.die.UserService] (executor-thread-192) Got user encoded io.github.oliviercailloux.diet.dao.Base64#4ca04a5c.
2021-12-20 01:35:44,656 INFO [io.git.oli.die.UserService] (executor-thread-192) Got user encoded io.github.oliviercailloux.diet.dao.Base64#4ca04a5c, with events size 0.
2021-12-20 01:35:44,656 INFO [io.git.oli.die.VideoService] (executor-thread-192) Querying for videos.
(…)
I would like to have a supplementary entry that indicates the incoming time (something like 2021-12-20 01:35:43,232 TRACE [org.some-quarkus-class] (executor-thread-192) incoming request), so that I can compute the time taken by each step compared to the starting time. Currently, the intermediate time stamps are visible, but not the incoming time stamp.
This is related to this question and this bug report (or this issue); and probably I could plug into the HttpAuthenticationMechanism Customization mechanism, but these provide only indirect solutions or workarounds. I hope that some simple solution exists, like a simple configuration entry, that allows to log an entry at the start of the request.
Here is the relevant part of my current application.properties.
quarkus.http.auth.basic=true
quarkus.http.auth.proactive=false
quarkus.security.jaxrs.deny-unannotated-endpoints=true
quarkus.hibernate-orm.log.sql=true
quarkus.hibernate-orm.log.bind-parameters=true
quarkus.log.min-level=TRACE
quarkus.log.category."org.apache.http".level=DEBUG
quarkus.http.access-log.enabled=true
quarkus.http.record-request-start-time=true
quarkus.http.access-log.pattern=%{REMOTE_HOST} %l %{REMOTE_USER} %{DATE_TIME} "%{REQUEST_LINE}" %{RESPONSE_CODE} %b %{RESPONSE_TIME} %T

jMeter ignoring Thread groups

I am using jMeter to do some performance testing.
All thread groups are almost identical - differs only in name and in http request inside (see structure below). Although all are defined the same, the run seems to ignore some of those. Only two out of 10 are running.
I have set the log level to debug and there is still no mention of the other TG (thread groups). It's not even first two that would work, but more like third and fifth or so.
Doesn't make any sense to me. Any ideas?
I have following definition:
Test Plan
- variables#1 - constants
- variables#2 - environment variables (user defined)
- variables#3 - another variables used to enable/disable certain tests
- CSV dataset config - data#1
- CSV dataset config - data#2
- HTTP Request defaults (hostname, protocol and port are defined) + implicit parameters (e.g. callingApp=jmeter - part of GET in url)
-view results tree
-log aggregate report
-thread group A (arrivals - extension)
--If Controller*1
---HTTP request with specific path
----some assertions
-thread group B - E (all are the same as A, only different urls are used)
Ran using:
$config="-DrampUpTime=1 ..."
mvn clean verify $config
Didn't find anything in related logs or any of the settings
Related pom.xml bits:
plugin:com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0
plugin-<config>
<jmeterVersion>5.1.1</jmeterVersion>
<overrideRootLogLevel>DEBUG</overrideRootLogLevel>
<resultsFileFormat>jtl</resultsFileFormat>
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins-casutg:${jmeter.plugins.catsug.version}</artifact>
</jmeterExtensions>
Shoot me now. Just found it.
<com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroup guiclass="com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroupGui" testclass="com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroup" testname="/something/something/something" enabled="false">
enabled="false"
Apparently there is a possibility to disable the test and for fun it only differs in slightly more gray font (in the dark theme) in GUI.
On my defense, I did not create the test suite, so at least it was not me, who disabled it.
wastedHoursCounter=5;

Running JMeter in Command mode is not creating any log for anything under while loop in .jmx file

I have a .jmx file with two thread groups. The first thread group is for data comparison (DB Vs API) and has a JDBC request where I plugin my SQL script and saves it to a tab delimited file. Then I have a while loop under which I have an HTTP request.
Second thread group for negative scenarios validation.
Below is the structure of the .jmx file
-- Thread Group Name - FX-Rates
-- JDBC Request Name - FX-SQL
-- While loop
-- HTTP Request - FX Rates - API
-- Thread Group Name - Negative Testing
-- Error Codes
I am running JMeter in Non GUI mode using below command.
jmeter -n -t "F:\MY DOCUMENTS\PSM\PSM_Automation\bin\Non_GUI_FX_Rates_Validation.jmx" -l "F:\MY DOCUMENTS\PSM\PSM_Automation\log\Non_GUI_FX_Rates_Validation.jtl"
I see that it is creating log for each individual sampler i.e; SQL and negative scenarios but not for anything under while loop. Below is the log that it created.
Logfile:
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
1492185939615,12140,FX - SQL,200,OK,FX Rates 1-1,text,true,,18549,0,1,1,12017,0,1566
1492185951933,0,Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal character in query at index 80: https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF},Negative Testing - Error Codes 2-1,text,false,,1105,0,1,1,0,0,0
1492185951935,190,Error 404: No Account,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,232,1,1,189,0,170
1492185952127,20,Error 404: Incorrect URL,404,Not Found,Negative Testing - Error Codes 2-1,text,false,,354,241,1,1,19,0,12
1492185952147,19,Error 204: No Data ,404,Not Found,Negative Testing - Error Codes 2-1,text,true,,354,260,1,1,19,0,12
Obviously, the kind of sampler result is there:
Error 400: Invalid Date Format,Non HTTP response code: java.net.URISyntaxException,Non HTTP response message: Illegal
character in query at index 80:
https://sys-fxrt-v0.apps.system.pcf.ntrs.com/foreign-exchange-rates?as-of-date=${D_EXCH_RT_EFF}
Obviously that is because the D_EXCH_RT_EFF is not set/resolved in your URL.
That's the problem you're gonna debug.
Obviously.
If you're already doing that (debugging), and run into a problem during it - then describe it please.
And show two things: how you set (initialize) the variable; how you use it, means, literally, show your HTTP sampler (yes, screenshot, at least).
The reasons of not entering the "While Loop" can be in:
While condition is returning false
While condition is wrong
If your While Condition depends on a variable coming from JDBC Request Name - FX-SQL sampler - double check this variable value using Debug Sampler and View Results Tree listener combination.
General "good practice" is running your test with 1-2 virtual users in GUI mode and inspect requests and responses details in the View Results Tree listener. Also pay attention to any suspicious entries in jmeter.log file. Don't run your JMeter test with the full load until you are totally sure that it is doing what it is supposed to be doing. See How to Debug your Apache JMeter Script article for more information on JMeter tests troubleshooting techniques.

Accounting Program Error

I have Oracle Application R12 running on 11g.
The error occurs in Accounting Program when we are running Create Accounting session in Payable Module.
When we click on Diagnostics it gives this message :
This request finished with an error and produced the following
completion message: An internal error occurred. Please inform your
system administrator or support representative that:
An internal error has occurred in the program
xla_ap_acct_hooks_pkg.main. Technical problem : Error encountered in
product API for extrac
The processing began on 24-MAR-2015 09:11:13
and ended on 24-MAR-2015 09:12:16. You may find more information on
the cause of the error in the request log or the concurrent manager
log.
and if we click on View log it gives this :
+---------------------------------------------------------------------------+ Subledger Accounting: Version : 12.0.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XLAACCUP module: Accounting Program
+---------------------------------------------------------------------------+
Current system time is 25-MAR-2015 11:09:05
+---------------------------------------------------------------------------+
Starts25-MAR-2015 11:09:06
Ends25-MAR-2015 11:10:43 An internal error occurred. Please inform your system administrator or support representative that:
An internal error has occurred in the program
xla_ap_acct_hooks_pkg.main. Technical problem : Error encountered in
product API for extract An internal error occurred. Please inform
your system administrator or support representative that:
An internal error has occurred in the program
xla_ap_acct_hooks_pkg.main. Technical problem : Error encountered in
product API for extract
+---------------------------------------------------------------------------+ Start of log messages from FND_FILE
+---------------------------------------------------------------------------+ 25-MAR-2015 11:25:17 - Executing Unit Processor ... 25-MAR-2015
11:25:17 - Initializing variables 25-MAR-2015 11:25:17 - Security
Context Set 25-MAR-2015 11:25:17 - Ready to cache the Application and
Ledger Level Sources ... 25-MAR-2015 11:25:21 - Cached the Application
and Ledger Level Sources 25-MAR-2015 11:25:22 - Entering the loop to
read document units from the queue ... 25-MAR-2015 11:25:22 - Checking
status of the parent Accounting Program 25-MAR-2015 11:25:22 -
Dequeuing the unit from the queue 25-MAR-2015 11:25:22 - Fetching
event information for the documents in the unit 25-MAR-2015 11:26:00 -
executing extract hook event key =
527717-11312076-1219A353A3BA70B9E05400144F2BF644 25-MAR-2015 11:26:03
- extract hook executed successfully
*************************************************************************************************** The following REVERSAL events could not be processed. The
event/process status is U/U: Note: this warning may be ignored for
any events whose ledger is a cash-basis ledger
-------NO SUCH EVENTS-----------
*************************************************************************************************** 25-MAR-2015 11:26:40 - executing postprocessing hook event key =
527717-11312076-1219A353A3BA70B9E05400144F2BF644 25-MAR-2015 11:26:40
- postprocessing hook executed successfully 25-MAR-2015 11:26:40 - Completing Journal Entries 25-MAR-2015 11:26:41 - Checking status of
the parent Accounting Program 25-MAR-2015 11:26:41 - Dequeuing the
unit from the queue 25-MAR-2015 11:26:41 - Fetching event information
for the documents in the unit 25-MAR-2015 11:26:43 - executing extract
hook event key = 527717-11312076-1219A353A3BB70B9E05400144F2BF644
25-MAR-2015 11:26:47 - extract hook executed successfully
*************************************************************************************************** The following REVERSAL events could not be processed. The
event/process status is U/U: Note: this warning may be ignored for
any events whose ledger is a cash-basis ledger
-------NO SUCH EVENTS-----------
*************************************************************************************************** 25-MAR-2015 11:26:51 - executing postprocessing hook event key =
527717-11312076-1219A353A3BB70B9E05400144F2BF644 25-MAR-2015 11:26:51
- postprocessing hook executed successfully 25-MAR-2015 11:26:51 - Completing Journal Entries 25-MAR-2015 11:26:51 - Checking status of
the parent Accounting Program 25-MAR-2015 11:26:51 - Dequeuing the
unit from the queue 25-MAR-2015 11:26:51 - Fetching event information
for the documents in the unit 25-MAR-2015 11:26:52 - executing extract
hook Technical problem : Error encountered in product API for extract
+---------------------------------------------------------------------------+ End of log messages from FND_FILE
+---------------------------------------------------------------------------+
+---------------------------------------------------------------------------+ Executing request completion options...
Finished executing request completion options.
+---------------------------------------------------------------------------+ Concurrent request completed Current system time is 25-MAR-2015
11:10:43
+---------------------------------------------------------------------------+
Screenshots are in the attachment to get better idea !!
Thanks in advance !!
![enter image description here][1]
Referencing MOS Doc ID 1964046.1 it appears as though you will need a patch.
Note: While it is typically SO best practice to include quotes from whatever source you are linking it is actually violating the ToS with Oracle to quote their MOS documentation. I like my support contract, TYVM.
Also there could be an issue with this, please reference MOS Doc ID 1582378.1 :
*************************************************************************************************** The following REVERSAL events could not be processed. The
event/process status is U/U: Note: this warning may be ignored for any
events whose ledger is a cash-basis ledger -------NO SUCH
EVENTS-----------
If this is a production environment I highly recommend opening an SR to confirm that this is the only issue you are seeing.
It could be because of the following reason.
There is some orphan record exists in xla_transaction_entities table. Delete those lines from the table. It will be Ok. To identify the record, you can use the below query:
SELECT *
FROM xla.xla_transaction_entities xla_tran_ent
WHERE 1 = 1
AND application_id = 200
AND NOT EXISTS (
SELECT 1
FROM xla_ae_headers xla_header
WHERE 1 = 1
AND xla_header.application_id = xla_tran_ent.application_id
AND xla_header.entity_id = xla_tran_ent.entity_id)
AND NOT EXISTS (
SELECT 1
FROM ap_invoices_all ap_inv
WHERE xla_tran_ent.source_id_int_1 = ap_inv.invoice_id
AND xla_tran_ent.entity_code = 'AP_INVOICES')
AND NOT EXISTS (
SELECT 1
FROM ap_checks_all ap_inv
WHERE xla_tran_ent.source_id_int_1 = ap_inv.check_id
AND xla_tran_ent.entity_code = 'AP_PAYMENTS')

Client application hangs when inserting into table on Oracle using ArrayBinding

Here is our environment:
.Net version: 4.5
Database: Oracle 12.1.0.2 (odp.net)
We are using LLBL "Adapter" but I don't think that has anything to do with the issue
LLBLGen Pro version: 4.1
Llbl Gen Pro Runtime: 4.1.13.1213
When we do an Insert(always into different tables which we are using for the short period and then removing) we use the following code:
int numRecords = strings.Count();
var insertCmd = "insert into " + tableName + " (StringField) values (:StringField)";
var oracleCommand = new OracleCommand();
oracleCommand.CommandText = insertCmd;
oracleCommand.CommandType = CommandType.Text;
oracleCommand.BindByName = true;
oracleCommand.ArrayBindCount = numRecords;
oracleCommand.Parameters.Add(":StringField", OracleDbType.NVarchar2, strings.ToArray(), ParameterDirection.Input);
// this is an LLBL adapter. Like I said, I think the issue is below the LLBL layer.
this.adapter.ExecuteActionQuery(new ActionQuery(oracleCommand));
When the database is getting hit hard with multiple of these inserts in parallel, we get the following error and the insert call never returns from the database.
WG_6.Index_586.TVD: An exception was caught during the execution of an action query: ORA-24381: error(s) in array DML
ORA-12592: TNS:bad packet
ORA-12592: TNS:bad packet
ORA-12592: TNS:bad packet
ORA-12592: TNS:bad packet
ORA-03111: break received on communication channel
ORA-03111: break received on communication channel
ORA-03111: break received on communication channel
On the database, using Toad's session browser, I can see that the "Current Statement" is correct.
insert into schemaX.tableY(StringField) values(:Stringfield)
Under the Waits tab in Toad, there is the following message:
“Waiting for SQL*Net more data from client - waited X hundred seconds, so far” and the X keeps incrementing until we hit our database timeout.
We tried with batches of 1 million and this gave us the best performance for our scenario. However, this hanging issue arose. I then decrease the ArrayBindCount to 500K, 100K, 50K, 10K and then 5K. Only when I used 5K did it stop happening.
A couple of notes:
This happens more frequently when the database is on a different physical machine than the client. When using a local VM, it rarely happens. The network that we are using is generally very reliable with no other noted issues.
From the error message(ORA-12592: TNS:bad packet), it seems that the issue might be on the client and perhaps related to code in the "Oracle.DataAccess.Client"(ODAC) dll.
My next steps for troubleshooting are to use Reflector to debug the call from the ODAC code and also to get more reliable client side tracing while forcing this error to occur.
I had the same situation when trying to insert into an Oracle table using the ArrayBinding.
Using a small number for oracleCommand.ArrayBindCount seemed to improve the frequency of the errors (same like yours) but not completely.
The solution was to use the Managed data access. I suggest you get the latest ODP.NET, add a reference to ManagedDataAccess and change to:
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.Types;
This fixed problem in my case and with no need to change anything in the code.

Resources