View Issue Details

IDProjectCategoryView StatusLast Update
0005366SymmetricDSBugpublic2023-09-13 17:25
ReporterBenoitR Assigned Toelong  
Prioritynormal 
Status closedResolutionopen 
Product Version3.13.4 
Summary0005366: Problem with Alter table after migration from 3.3 to 3.13.4
DescriptionI'm migrating from an old SymmetricDS version. I've reinstalled all my environments, and have a probel with my SQL servers (2016) sync. All the firsts jobs are fine, but i met a problem with a table alter :

2022-07-19 15:39:10,745 INFO [SymmetricDS] [DefaultDatabaseWriter] [symmetricds-dataloader-6] About to create table using the following definition: <?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="dataextractor">
    <table name="RFI_TYPORGANE">
        <column name="TYP_ID" primaryKey="true" primaryKeySeq="1" required="true" type="NUMERIC" size="18" autoIncrement="true">
            <platform-column name="mssql2016" type="numeric() identity" size="18"/>
        </column>
        <column name="TYP_TYPEPERID" type="NUMERIC" size="18">
            <platform-column name="mssql2016" type="numeric" size="18"/>
        </column>
        <column name="TYP_LIB" type="VARCHAR" size="30">
            <platform-column name="mssql2016" type="varchar" size="30"/>
        </column>
        <column name="TYP_COD" type="VARCHAR" size="10">
            <platform-column name="mssql2016" type="varchar" size="10"/>
        </column>
        <column name="TYP_ACTIF" type="BIT" size="1">
            <platform-column name="mssql2016" type="bit" size="1"/>
        </column>
        <foreign-key name="FK_RFI_TYPO_STYP_RFI_TYPO" foreignTable="RFI_TYPORGANE" foreignTableCatalog="" foreignTableSchema="">
            <reference local="TYP_TYPEPERID" foreign="TYP_ID"/>
        </foreign-key>
        <index name="STYP_FK">
            <index-column name="TYP_TYPEPERID"/>
        </index>
    </table>
</database>
2022-07-19 15:39:10,767 ERROR [SymmetricDS] [DefaultDatabaseWriter] [symmetricds-dataloader-6] Failed to alter table using the following xml: <?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="dataextractor">
    <table name="RFI_TYPORGANE">
        <column name="TYP_ID" primaryKey="true" primaryKeySeq="1" required="true" type="NUMERIC" size="18" autoIncrement="true">
            <platform-column name="mssql2016" type="numeric() identity" size="18"/>
        </column>
        <column name="TYP_TYPEPERID" type="NUMERIC" size="18">
            <platform-column name="mssql2016" type="numeric" size="18"/>
        </column>
        <column name="TYP_LIB" type="VARCHAR" size="30">
            <platform-column name="mssql2016" type="varchar" size="30"/>
        </column>
        <column name="TYP_COD" type="VARCHAR" size="10">
            <platform-column name="mssql2016" type="varchar" size="10"/>
        </column>
        <column name="TYP_ACTIF" type="BIT" size="1">
            <platform-column name="mssql2016" type="bit" size="1"/>
        </column>
        <foreign-key name="FK_RFI_TYPO_STYP_RFI_TYPO" foreignTable="RFI_TYPORGANE" foreignTableCatalog="" foreignTableSchema="">
            <reference local="TYP_TYPEPERID" foreign="TYP_ID"/>
        </foreign-key>
        <index name="STYP_FK">
            <index-column name="TYP_TYPEPERID"/>
        </index>
    </table>
</database> StackTraceKey.init [NullPointerException:2757838042] java.lang.NullPointerException
    at org.jumpmind.db.alter.AddIndexChange.apply(AddIndexChange.java:86)
    at org.jumpmind.db.platform.AbstractDdlBuilder.processChange(AbstractDdlBuilder.java:565)
    at org.jumpmind.db.platform.AbstractDdlBuilder.processChanges(AbstractDdlBuilder.java:435)
    at org.jumpmind.db.platform.AbstractDdlBuilder.processChanges(AbstractDdlBuilder.java:422)
    at org.jumpmind.db.platform.mssql.MsSql2000DdlBuilder.processChanges(MsSql2000DdlBuilder.java:408)
    at org.jumpmind.db.platform.AbstractDdlBuilder.alterDatabase(AbstractDdlBuilder.java:363)
    at org.jumpmind.db.platform.AbstractDdlBuilder.alterDatabase(AbstractDdlBuilder.java:313)
    at org.jumpmind.db.platform.AbstractDatabasePlatform.alterTables(AbstractDatabasePlatform.java:247)
    at org.jumpmind.db.platform.AbstractDatabasePlatform.alterDatabase(AbstractDatabasePlatform.java:220)
    at org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter.create(DefaultDatabaseWriter.java:613)
    at org.jumpmind.symmetric.io.data.writer.AbstractDatabaseWriter.write(AbstractDatabaseWriter.java:180)
    at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.write(NestedDataWriter.java:62)
    at org.jumpmind.symmetric.model.ProcessInfoDataWriter.write(ProcessInfoDataWriter.java:84)
    at org.jumpmind.symmetric.io.data.writer.NestedDataWriter.write(NestedDataWriter.java:62)
    at org.jumpmind.symmetric.io.data.writer.TransformWriter.write(TransformWriter.java:190)
    at org.jumpmind.symmetric.io.data.DataProcessor.forEachDataInTable(DataProcessor.java:194)
    at org.jumpmind.symmetric.io.data.DataProcessor.forEachTableInBatch(DataProcessor.java:160)
    at org.jumpmind.symmetric.io.data.DataProcessor.process(DataProcessor.java:108)
    at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1023)
    at org.jumpmind.symmetric.service.impl.DataLoaderService$LoadIntoDatabaseOnArrivalListener$2.call(DataLoaderService.java:1001)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)


I've tested a lot of things, but nothing to do...
Tagsddl/schema, dialect: sql-server

Activities

elong

2022-08-10 20:45

developer   ~0002154

I tried the XML on SQL-Server 2016, but it works for me. First, I import the XML to get the table, index, and foreign key created:

INFO [gui] [DefaultDatabaseWriter] [qtp1078566479-4445] About to create table using the following definition: <?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="dbimport">
    <table name="RFI_TYPORGANE">
        <column name="TYP_ID" primaryKey="true" primaryKeySeq="1" required="true" type="NUMERIC" size="18" autoIncrement="true">
            <platform-column name="mssql2016" type="numeric() identity" size="18"/>
        </column>
        <column name="TYP_TYPEPERID" type="NUMERIC" size="18">
            <platform-column name="mssql2016" type="numeric" size="18"/>
        </column>
        <column name="TYP_LIB" type="VARCHAR" size="30">
            <platform-column name="mssql2016" type="varchar" size="30"/>
        </column>
        <column name="TYP_COD" type="VARCHAR" size="10">
            <platform-column name="mssql2016" type="varchar" size="10"/>
        </column>
        <column name="TYP_ACTIF" type="BIT" size="1">
            <platform-column name="mssql2016" type="bit" size="1"/>
        </column>
        <foreign-key name="FK_RFI_TYPO_STYP_RFI_TYPO" foreignTable="RFI_TYPORGANE" foreignTableCatalog="" foreignTableSchema="">
            <reference local="TYP_TYPEPERID" foreign="TYP_ID"/>
        </foreign-key>
        <index name="STYP_FK">
            <index-column name="TYP_TYPEPERID"/>
        </index>
    </table>
</database>
INFO [gui] [MsSql2016DatabasePlatform] [qtp1078566479-4445] Running alter sql:
SET quoted_identifier on;
SET quoted_identifier on;
CREATE TABLE "elong2"."dbo"."rfi_typorgane"(
    "typ_id" numeric NOT NULL IDENTITY (1,1) ,
    "typ_typeperid" numeric(18),
    "typ_lib" varchar(30),
    "typ_cod" varchar(10),
    "typ_actif" bit,
    PRIMARY KEY ("typ_id")
);
CREATE INDEX "styp_fk" ON "elong2"."dbo"."rfi_typorgane" ("typ_typeperid");
ALTER TABLE "elong2"."dbo"."rfi_typorgane"
    ADD CONSTRAINT "fk_rfi_typo_styp_rfi_typo" FOREIGN KEY ("typ_typeperid") REFERENCES "elong2"."dbo"."rfi_typorgane" ("typ_id");

Then I run I drop the index with "drop index styp_fk on rfi_typorgane". That way, it will think there is an index apply to change, which is the operation it was running in the thread stack trace you posted. Then I import the XML again.

INFO [gui] [MsSql2016DatabasePlatform] [qtp1078566479-6946] Running alter sql:
SET quoted_identifier on;
CREATE INDEX "styp_fk" ON "elong2"."dbo"."rfi_typorgane" ("typ_typeperid");

I thought maybe there was a case sensitivity issue, but the code is doing equalsIgnoreCase() when looking up the table. Any ideas on steps to reproduce the issue?

Issue History

Date Modified Username Field Change
2022-07-19 13:55 BenoitR New Issue
2022-08-05 16:53 elong Tag Attached: ddl/schema
2022-08-05 16:53 elong Tag Attached: dialect: sql-server
2022-08-10 20:45 elong Note Added: 0002154
2022-08-10 20:45 elong Assigned To => elong
2022-08-10 20:45 elong Status new => feedback
2023-09-13 17:25 emiller Status feedback => closed