Skip to content

Commit 54f7601

Browse files
authored
Optimized Txn publish fetch query (#546)
* Optimized Txn fetch query * Fixed SNS publish batch-size issue * fixed sns msg id
1 parent 49f923b commit 54f7601

File tree

9 files changed

+19
-9
lines changed

9 files changed

+19
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Naksha_1.1.4
2+
3+
- Optimized Txn fetch query to avoid long-running query issue against space with very old last published transaction Id
4+
15
## Naksha_1.1.3
26

37
- Increased DB Pool size of Naksha Admin DB from 10 to 25 to allow additional sequencer/publisher jobs to run in parallel.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<groupId>com.here.xyz</groupId>
4343
<artifactId>xyz-hub</artifactId>
44-
<version>1.1.3</version>
44+
<version>1.1.4</version>
4545
<packaging>pom</packaging>
4646

4747
<modules>

xyz-connectors/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

xyz-hub-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../pom.xml</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

xyz-hub-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

xyz-models/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

xyz-psql-connector/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

xyz-psql-connector/src/main/resources/naksha_ext.sql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ CREATE OR REPLACE FUNCTION xyz_config.naksha_fetch_newer_transactions( in_hst_sc
14941494
AS
14951495
$BODY$
14961496
DECLARE
1497+
table_name TEXT;
14971498
txn_stmt TEXT;
14981499
txn_record RECORD;
14991500
crt_txn_rec_id int8;
@@ -1502,12 +1503,17 @@ DECLARE
15021503
fetched_count int;
15031504
BEGIN
15041505
-- Statement to fetch newer transaction Id(s) from Transactions table for a given space
1506+
-- We use "schema" and "table" based query (instead of space) to hit the right index
1507+
--txn_stmt:= format('SELECT t.id, t.txn FROM xyz_config.transactions t '
1508+
-- ||'WHERE t.space = $1 AND t.id >= $2 ORDER BY t.id ASC LIMIT %s', in_limit_rows+1);
15051509
txn_stmt:= format('SELECT t.id, t.txn FROM xyz_config.transactions t '
1506-
||'WHERE t.space = $1 AND t.id >= $2 ORDER BY t.id ASC LIMIT %s', in_limit_rows+1);
1510+
||'WHERE t."schema" = $1 AND t."table" = $2 AND t.id >= $3 ORDER BY t.id ASC LIMIT %s', in_limit_rows+1);
15071511

1512+
table_name := replace(in_hst_table, '_hst', '');
15081513
fetched_count := 0;
15091514
-- Fetch transaction Id(s)
1510-
FOR txn_record IN EXECUTE txn_stmt USING in_space, in_last_txn_id LOOP
1515+
--FOR txn_record IN EXECUTE txn_stmt USING in_space, in_last_txn_id LOOP
1516+
FOR txn_record IN EXECUTE txn_stmt USING in_hst_schema, table_name, in_last_txn_id LOOP
15111517
EXIT WHEN fetched_count >= in_limit_rows;
15121518
--RAISE NOTICE 'Transaction fetched is %', txn_record;
15131519

xyz-txn-handler/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<groupId>com.here.xyz</groupId>
2626
<artifactId>xyz-hub</artifactId>
2727
<relativePath>../</relativePath>
28-
<version>1.1.3</version>
28+
<version>1.1.4</version>
2929
</parent>
3030

3131
<licenses>

0 commit comments

Comments
 (0)