Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casl 398 dlb perf test #332

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ mavenPassword=YourPassword
# - here-naksha-lib-core/NakshaVersion (static property: latest)
# - here-naksha-lib-psql/resources/naksha_plpgsql.sql (method: naksha_version)
# - here-naksha-app-service/src/main/resources/swagger/openapi.yaml (info.version property)
cyberhead-pl marked this conversation as resolved.
Show resolved Hide resolved
version=2.1.1
version=2.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ servers:
info:
title: "Naskha Hub-API"
description: "Naksha Hub-API is a REST API to provide simple access to geo data."
version: "2.1.1"
version: "2.1.2"

security:
- AccessToken: [ ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ void initSession(@NotNull SQL sql, @Nullable NakshaContext context) {
sql.addLiteral(context.getStreamId());
sql.add(");\n");
}
sql.add("SET SESSION work_mem TO '256 MB';\n");
sql.add("SET SESSION enable_seqscan TO OFF;\n");
// TODO : can be changed to debug later, when timeout issues have settled (and logs are too noisy)
log.info("Init session using stmtTimeout={}ms, lockTimeout={}ms", stmtTimeout, lockTimeout);
sql.add("SET SESSION statement_timeout TO ").add(stmtTimeout).add(";\n");
Expand Down
22 changes: 11 additions & 11 deletions here-naksha-lib-psql/src/main/resources/naksha_plpgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ BEGIN
END IF;
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
-- Feature inserted or updated, ensure that there is no pending version in the deletion table.
sql = format('DELETE FROM %I WHERE jsondata->>''id'' = $1;', format('%s_del', collection_id));
sql = format('DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C";', format('%s_del', collection_id));
--RAISE NOTICE '% USING $1=%', sql, NEW.jsondata->>'id';
EXECUTE sql USING NEW.jsondata->>'id';
--RAISE NOTICE 'INSERT %', NEW.jsondata;
Expand Down Expand Up @@ -1335,23 +1335,23 @@ BEGIN
--RAISE NOTICE 'Start write_features';
txn = naksha_txn();
-- id
select_head_stmt = format('SELECT jsondata, geo FROM %I WHERE jsondata->>''id''=$1;', table_name);
select_head_stmt = format('SELECT jsondata, geo FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C";', table_name);
-- feature, geo
insert_stmt = format('INSERT INTO %I (jsondata, geo) VALUES ($1, ST_Force3D($2)) RETURNING jsondata;', table_name);
-- feature, geo, id
update_stmt = format('UPDATE %I SET jsondata=$1, geo=ST_Force3D($2) WHERE jsondata->>''id''=$3 RETURNING jsondata;', table_name);
update_stmt = format('UPDATE %I SET jsondata=$1, geo=ST_Force3D($2) WHERE (jsondata->>''id''::text) COLLATE "C"=$3::text COLLATE "C" RETURNING jsondata;', table_name);
-- feature, geo, id, uuid
update_atomic_stmt = format('UPDATE %I SET jsondata=$1, geo=ST_Force3D($2) WHERE jsondata->>''id''=$3 AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$4 RETURNING jsondata;', table_name);
update_atomic_stmt = format('UPDATE %I SET jsondata=$1, geo=ST_Force3D($2) WHERE (jsondata->>''id''::text) COLLATE "C"=$3::text COLLATE "C" AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$4 RETURNING jsondata;', table_name);
-- id
delete_stmt = format('DELETE FROM %I WHERE jsondata->>''id''=$1 RETURNING jsondata, geo;', table_name);
delete_stmt = format('DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C" RETURNING jsondata, geo;', table_name);
-- id, uuid
delete_atomic_stmt = format('DELETE FROM %I WHERE jsondata->>''id''=$1 AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$2 RETURNING jsondata, geo;', table_name);
delete_atomic_stmt = format('DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C" AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$2 RETURNING jsondata, geo;', table_name);
-- id
purge_stmt = format('DELETE FROM %I WHERE jsondata->>''id''=$1 RETURNING jsondata, geo;', collection_id||'_del');
purge_stmt = format('DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C" RETURNING jsondata, geo;', collection_id||'_del');
-- id, uuid
purge_atomic_stmt = format('DELETE FROM %I WHERE jsondata->>''id''=$1 AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$2 RETURNING jsondata, geo;', collection_id||'_del');
purge_atomic_stmt = format('DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C" AND jsondata->''properties''->''@ns:com:here:xyz''->>''uuid''=$2 RETURNING jsondata, geo;', collection_id||'_del');
-- id
select_del_stmt = format('SELECT jsondata, geo FROM %I WHERE jsondata->>''id''=$1;', collection_id||'_del');
select_del_stmt = format('SELECT jsondata, geo FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$1::text COLLATE "C";', collection_id||'_del');
i = 1;
WHILE i <= arr_size
LOOP
Expand Down Expand Up @@ -1641,7 +1641,7 @@ BEGIN
|| ' SET_CONFIG(''plan_cache_mode'', ''force_generic_plan'', false)'
|| ',SET_CONFIG(''cursor_tuple_fraction'', ''1.0'', false)'
|| ',SET_CONFIG(''geqo'', ''false'', false)'
|| ',SET_CONFIG(''work_mem'', ''1024 MB'', false)'
|| ',SET_CONFIG(''work_mem'', ''256 MB'', false)'
|| ',SET_CONFIG(''maintenance_work_mem'', ''1024 MB'', false)'
|| ',SET_CONFIG(''constraint_exclusion'', ''partition'', false)' -- default partition
|| ',SET_CONFIG(''enable_seqscan'', ''off'', false)'
Expand Down Expand Up @@ -3006,7 +3006,7 @@ BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
-- purge feature from deletion table and write history.
stmt := format('INSERT INTO %I (jsondata,geo,i) VALUES($1,$2,$3);'
|| 'DELETE FROM %I WHERE jsondata->>''id'' = $4;',
|| 'DELETE FROM %I WHERE (jsondata->>''id''::text) COLLATE "C"=$4::text COLLATE "C";',
format('%s_hst', tg_table_name),
format('%s_del', tg_table_name)
);
Expand Down
Loading