Skip to content

Commit ff95a2a

Browse files
gunplarxeus2001
andauthored
V3 casl 1495 toast tuple target (#539)
* CASL-1495 set toast_tuple_target Signed-off-by: phmai <phuc.mai@here.com> * Fix circular references from PgTable to PgAdminMap Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com> * CASL-1495 bump version to beta 31 Signed-off-by: phmai <phuc.mai@here.com> --------- Signed-off-by: phmai <phuc.mai@here.com> Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com> Co-authored-by: Alexander Lowey-Weber <alexander.weber@here.com>
1 parent caeafc7 commit ff95a2a

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mavenPassword=YourPassword
1616
# here-naksha-lib-psql/src/commonMain/kotlin/naksha/psql/LibPsql.kt (adminVersion property)
1717
# Warning: Only update LibPsql version, if there is a change in SQL functions!
1818
# The reason is, that this version is encoded in the database, and when updated, forced an upgrade!
19-
version=3.0.0-beta.30
19+
version=3.0.0-beta.31
2020

2121
org.gradle.jvmargs=-Xmx12g
2222
kotlin.code.style=official

here-naksha-app-service/src/jvmMain/resources/swagger/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ servers:
1010
info:
1111
title: "Naskha Hub-API"
1212
description: "Naksha Hub-API is a REST API to provide simple access to geo data."
13-
version: "3.0.0-beta.30"
13+
version: "3.0.0-beta.31"
1414

1515
security:
1616
- AccessToken: [ ]

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/NakshaVersion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class NakshaVersion(
8989
* The current version as string to constant usage cases.
9090
* @since 3.0
9191
*/
92-
const val CURRENT = "3.0.0-beta.30"
92+
const val CURRENT = "3.0.0-beta.31"
9393
// WARNING: Do not update this property manually, it is automatically modified when building!
9494
// Edit version only in `gradle.properties` file, which is used as well to create artifacts!
9595

here-naksha-lib-psql/src/commonMain/kotlin/naksha/psql/PgAdminMap.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ abstract class PgAdminMap internal constructor(
166166
val config_version = config.version
167167
val psql_version = if (config_version != null) NakshaVersion.of(config_version) else adminVersion
168168

169-
// This only creates the logical structure, no database access is yet done!
170-
transactions = PgNakshaTransactions(this)
171-
dictionaries = PgNakshaDictionaries(this)
172-
maps = PgNakshaMaps(this)
173-
174169
// Switch to admin context.
175170
val conn = storage.newConnection(Naksha.adminOptions, false)
176171
conn.use {
@@ -245,6 +240,13 @@ SELECT basics.*, procs.* FROM basics, procs;
245240
has_naksha_storage_id = cursor.column("has_naksha_storage_id") as Boolean?
246241
has_naksha_storage_number = cursor.column("has_naksha_storage_number") as Boolean?
247242
}
243+
244+
// This only creates the logical structure, no database access is yet done!
245+
// Beware: We need to do this here, because `PgCollection` back-refers to `maxTupleSize` !
246+
transactions = PgNakshaTransactions(this)
247+
dictionaries = PgNakshaDictionaries(this)
248+
maps = PgNakshaMaps(this)
249+
248250
if (admin_schema_oid == null) {
249251
if (!doCreate) throw forbidden("Creation of admin-map needed, but forbidden by config")
250252
logger.info("Install Naksha admin-map in version $psql_version for storage $id / $number")

here-naksha-lib-psql/src/commonMain/kotlin/naksha/psql/PgTable.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ open class PgTable(
6565
) {
6666

6767
companion object PgTableCompanion {
68-
private const val toast_tuple_target: Int = 32736
69-
7068
/**
7169
* Tests if this is any HEAD table _(either root or a performance-partition)_.
7270
* @param name the table name.
@@ -203,6 +201,8 @@ open class PgTable(
203201
//
204202
// Now, PostgresQL maximum page size is 32768 (configurable at compile time), therefore, setting TOAST_TUPLE_TARGET to 32767
205203
// will ensure that whatever size a page is, PostgresQL will try to insert the row completely, before falling back to TOAST !
204+
val map = collection.map;
205+
val toast_tuple_target = if (map is PgAdminMap) map.maxTupleSize else map.storage.adminMap.maxTupleSize;
206206

207207
// Copy to stack, makes possible for the compiler to remember when values are not null!
208208
val partitionCount = this.partitionCount

0 commit comments

Comments
 (0)