[Geoserver-devel] Integrated GWC hardcodes GRIDSET_ID VARCHAR(32), while Geoserver has longer strings

Hi,

GeoServer 2.18.0 with embedded GWC: after adding new "Gridset" (here, "WGS
84 / UTM Zone 34N (EPSG:32634)") in section "Tile Caching" of a layer, I got
this error:

---------------
ERROR [geoserver.gwc] - Failed to get a quota store, the GeoWebCache disk
quota subsystem will stop working now
org.springframework.dao.ConcurrencyFailureException: Failed to create or
locate tileset TileSet[messir:countries_and_water#WGS 84 / UTM Zone 34N
(EPSG:32634)#image/png#408a9289e97a734867475b5c5178621c355e6e28] after 100
attempts; nested exception is
org.geowebcache.diskquota.jdbc.ParametricDataAccessException: Failed to
execute statement INSERT INTO TILESET select :key, :layerName, :gridSetId,
:blobFormat, :parametersId, 0 WHERE NOT EXISTS(SELECT 1 FROM TILESET WHERE
KEY = :key) with params: {blobFormat=image/png, gridSetId=WGS 84 / UTM Zone
34N (EPSG:32634), layerName=messir:countries_and_water,
parametersId=408a9289e97a734867475b5c5178621c355e6e28,
key=messir:countries_and_water#WGS 84 / UTM Zone 34N
(EPSG:32634)#image/png#408a9289e97a734867475b5c5178621c355e6e28}; nested
exception is org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
TILESET select ?, ?, ?, ?, ?, 0 WHERE NOT EXISTS(SELECT 1 FROM TILESET
WHERE KEY = ?)]; SQL state [90005]; error code [90005]; Value too long for
column GRIDSET_ID VARCHAR(32): 'WGS 84 / UTM Zone 34N (EPSG:32634)' (34);
SQL statement:
INSERT INTO TILESET select ?, ?, ?, ?, ?, 0 WHERE NOT EXISTS(SELECT 1 FROM
TILESET WHERE KEY = ?) [90005-119]; nested exception is
org.h2.jdbc.JdbcSQLException: Value too long for column GRIDSET_ID
VARCHAR(32): 'WGS 84 / UTM Zone 34N (EPSG:32634)' (34);
[... ETC ...]
Caused by: org.geowebcache.diskquota.jdbc.ParametricDataAccessException:
Failed to execute statement INSERT INTO TILESET select :key, :layerName,
:gridSetId, :blobFormat, :parametersId, 0 WHERE NOT EXISTS(SELECT 1 FROM
TILESET WHERE KEY = :key) with params: {blobFormat=image/png, gridSetId=WGS
84 / UTM Zone 34N (EPSG:32634), layerName=messir:countries_and_water,
parametersId=408a9289e97a734867475b5c5178621c355e6e28,
key=messir:countries_and_water#WGS 84 / UTM Zone 34N
(EPSG:32634)#image/png#408a9289e97a734867475b5c5178621c355e6e28}; nested
exception is org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
TILESET select ?, ?, ?, ?, ?, 0 WHERE NOT EXISTS(SELECT 1 FROM TILESET
WHERE KEY = ?)]; SQL state [90005]; error code [90005]; Value too long for
column GRIDSET_ID VARCHAR(32): 'WGS 84 / UTM Zone 34N (EPSG:32634)' (34);
SQL statement:
[... ETC ...]
Caused by: org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
TILESET select ?, ?, ?, ?, ?, 0 WHERE NOT EXISTS(SELECT 1 FROM TILESET
WHERE KEY = ?)]; SQL state [90005]; error code [90005]; Value too long for
column GRIDSET_ID VARCHAR(32): 'WGS 84 / UTM Zone 34N (EPSG:32634)' (34);
SQL statement:
[... ETC ...]
Caused by: org.h2.jdbc.JdbcSQLException: Value too long for column
GRIDSET_ID VARCHAR(32): 'WGS 84 / UTM Zone 34N (EPSG:32634)' (34); SQL
statement:
[... ETC ...]
-----------------

Indeed, GWC has hardcoded value "GRIDSET_ID VARCHAR(32)" (see code below),
while obviously GeoServer has strings with length > 32 chars to be recorded
in this column.

Any idea on how to fix this (without rebuilding GeoServer)?

Many thanks,
Victor Sinceac

PS: I posted the same on "users" forum, but I guess "dev" forum is more
appropriate...

geowebcache-master\geowebcache\diskquota\jdbc\src\main\java\org\geowebcache\diskquota\jdbc\SQLDialect.java
    // size guesses: 128 characters should be more than enough for layer
name, the gridset id
    // is normally an epsg code so 32 is way more than enough, the blob
format
    // is normally a mime plus some extras, again 64 should fit, a param id
is
    // a SHA-1 sum that uses 41 chars, the id is the sum of all the above
plus
    // connecting chars, 320 is again more than enough
    // bytes is going to be less than a zettabyte(one million petabytes,
10^21) for the
    // foreseeable future
....
    protected static final int GRIDSET_ID_SIZE = 32;
.....
    protected final Map<String, List&lt;String>> TABLE_CREATION_MAP =
            new LinkedHashMap<String, List&lt;String>>() {
                {
                    put(
                            "TILESET",
                            Arrays.asList( //
                                    "CREATE TABLE ${schema}TILESET (\n"
                                            + //
....
                                            " GRIDSET_ID VARCHAR("
                                            + GRIDSET_ID_SIZE
                                            + "),\n"
.....

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-Dev-f3819232.html