Bug #10613
Incremental conversion issue: temp-table dmo does not get converted
100%
Related issues
History
#1 Updated by Teodor Gorghe 10 months ago
- Setup a hotel GUI project or any dataset project, with incremental conversion.
- Do a full conversion with this file: p-test-inc.p
- Change the file to have this content: p-test-inc.p
- Run incremental conversion
You will notice this error:
[java] ./abl/p-test-inc.p
[java] Elapsed job time: 00:00:01.161
[java] EXPRESSION EXECUTION ERROR:
[java] ---------------------------
[java] javaname = p2o.javaPropertyName(getNoteString("schemaname"), false)
[java] ^ { No java name found for legacy name: tt1.f2 }
[java] ---------------------------
[java] ERROR:
[java] com.goldencode.p2j.pattern.TreeWalkException: ERROR! Active Rule:
[java] -----------------------
[java] RULE REPORT
[java] -----------------------
[java] Rule Type : WALK
[java] Source AST: [ tt1.f2 ] BLOCK/ASSIGNMENT/ASSIGN/FIELD_CHAR/ @7:1 {21474836529}
[java] Copy AST : [ tt1.f2 ] BLOCK/ASSIGNMENT/ASSIGN/FIELD_CHAR/ @7:1 {21474836529}
[java] Condition : javaname = p2o.javaPropertyName(getNoteString("schemaname"), false)
[java] Loop : false
[java] --- END RULE REPORT ---
[java]
[java]
[java]
[java] at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1104)
[java] at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:610)
[java] at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:583)
[java] at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:1058)
[java] at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1237)
[java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:16 [FIELD_CHAR id=21474836529]
[java] at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
[java] at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
[java] at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1698)
[java] at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1584)
[java] at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1517)
[java] at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1067)
[java] ... 4 more
[java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:16
[java] at com.goldencode.expr.Expression.execute(Expression.java:495)
[java] at com.goldencode.p2j.pattern.Rule.apply(Rule.java:500)
[java] at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:751)
[java] at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:717)
[java] at com.goldencode.p2j.pattern.Rule.apply(Rule.java:537)
[java] at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:751)
[java] at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:717)
[java] at com.goldencode.p2j.pattern.Rule.apply(Rule.java:537)
[java] at com.goldencode.p2j.pattern.RuleContainer.apply(RuleContainer.java:597)
[java] at com.goldencode.p2j.pattern.RuleSet.apply(RuleSet.java:98)
[java] at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:262)
[java] ... 9 more
[java] Caused by: com.goldencode.p2j.schema.SchemaException: No java name found for legacy name: tt1.f2
[java] at com.goldencode.p2j.schema.P2OLookup.javaName(P2OLookup.java:798)
[java] at com.goldencode.p2j.schema.P2OLookup.javaPropertyName(P2OLookup.java:861)
[java] at com.goldencode.p2j.schema.P2OAccessWorker$Library.javaPropertyName(P2OAccessWorker.java:468)
[java] at com.goldencode.expr.CE4979.execute(Unknown Source)
[java] at com.goldencode.expr.Expression.execute(Expression.java:398)
[java] ... 19 more
[java]
One cause of this issue can be that, the DMO associated with
tt1 temp-table does not get reconverted. This ends up with the old tt1, with only the f1 field.
On a customer application, there is another issue, but very related with this task:
- on full conversion, the DMO associated with
tt1is Tt1_1.java, but on the next incremental conversion, the DMO class is Tt1_2.java. This does not get generated on the incremental conversion, and the failure point is on compilation stage.
#2 Updated by Teodor Gorghe 10 months ago
+Danut
+Constantin
#3 Updated by Teodor Gorghe 10 months ago
Danut, the 6083a has a fix for this issue? I see that Constantin reported it on #10536-15.
#6 Updated by Constantin Asofiei 10 months ago
Teodor: please find the change from 6083a which can be applied to 9457c, to resolve this.
#7 Updated by Teodor Gorghe 10 months ago
The change that fixes the incremental conversion is dependent on the changes from the 6083a branch. I think pulling all the changes from 6083a is the easiest way to solve it.
#8 Updated by Constantin Asofiei 10 months ago
- Related to Feature #6083: schema (.df) changes in incremental conversion mode should only reconvert those programs that reference the changed schema added
#9 Updated by Constantin Asofiei 10 months ago
The root cause for this regression is the change to not process any .schema files if there are not changes in .df files, for incremental conversion. So, unless any .df file has changed, no .schema files for temp-tables will be processed.
#10 Updated by Greg Shah 10 months ago
- Related to Bug #10639: Incremental conversion - unexpected DMO generation for space-only changes added
#11 Updated by Dănuț Filimon 10 months ago
I can still reproduce #10613-1 with the latest 6083a. As far as I can remember, I did not fix this in the branch because it was also an issue in trunk.
Constantin Asofiei wrote:
This is not correct. Even if a .df file is not modified, the temp-tables for a modified file will still be processed as the source file was changed. You'll have the following steps:The root cause for this regression is the change to not process any .schema files if there are not changes in .df files, for incremental conversion. So, unless any .df file has changed, no .schema files for temp-tables will be processed.
- Pre-processing P2O Generation (temp-table schema files)
- P2O Generation (temp-table schema files)
- P2O Post-processing (temp-table schema files)
#12 Updated by Constantin Asofiei 10 months ago
Dănuț Filimon wrote:
I can still reproduce #10613-1 with the latest 6083a. As far as I can remember, I did not fix this in the branch because it was also an issue in trunk.
Constantin Asofiei wrote:
This is not correct. Even if a .df file is not modified, the temp-tables a modified file will still be processed as the source file was changed. You'll have the following steps:The root cause for this regression is the change to not process any .schema files if there are not changes in .df files, for incremental conversion. So, unless any .df file has changed, no .schema files for temp-tables will be processed.
- Pre-processing P2O Generation (temp-table schema files)
- P2O Generation (temp-table schema files)
- P2O Post-processing (temp-table schema files)
The something else is happening in trunk: the .dict has the changes I made to the file's temp-table before running incremental conversion, but the .schema doesn't. Also, this code will not generate the DMO .java code for temp-tables:
if (!cmode.omitSchemaBrew)
{
FileList dmos = generateDMOs(cmode.skipDBSchema);
if (dmos.size() > 0)
{
brew(dmos, "Data Model Objects (DMOs)");
}
FileList pojos = generatePOJOs(cmode.skipDBSchema);
if (pojos.size() > 0)
{
brew(pojos, "Plain 0ld Java 0bjects (P0J0s)");
}
}
#13 Updated by Dănuț Filimon 10 months ago
- Assignee set to Dănuț Filimon
#14 Updated by Dănuț Filimon 10 months ago
- Status changed from New to WIP
Indeed, the .dict file has the right f2 field, but the .p2o and .schema do not. There's P2OLookup.addJavaName which is called, but the .p2o is the one used to add fields/the table to the map, not the .schema. Finding where the dict file is correctly written, then checking where the p2o and schema should be modified should be a good start.
#15 Updated by Dănuț Filimon 10 months ago
The .dict file is created again when TransformDriver.runScanDriver() is called (ends up in AstGenerator.parse()), but the same call also cleans up the cvt sources (dict, p2o, schema) when the mode.schema is set to true. This is a regression introduced in trunk/16124.
#16 Updated by Dănuț Filimon 10 months ago
- Related to Bug #10208: do not convert the schema in incremental mode if it hasn't changed added
#17 Updated by Dănuț Filimon 10 months ago
Dănuț Filimon wrote:
The .dict file is created again when
TransformDriver.runScanDriver()is called (ends up inAstGenerator.parse()), but the same call also cleans up the cvt sources (dict, p2o, schema) when themode.schemais set to true. This is a regression introduced in trunk/16124.
I actually think this was a bug that is revealed by trunk/16124 changes. This can be reproduced by running a full conversion, than running incremental conversion where the schema = false (using modes). Since the changes disable the schema steps when none are detected, then this issue appears a lot more.
As for the fix...there are no persistent schema changes, but we modified temp-tables in the source file, which makes it so that there are schema changes that need to be reflected into the schema and p2o files.
#18 Updated by Dănuț Filimon 10 months ago
This is the patch I came up with:
=== modified file 'src/com/goldencode/p2j/convert/TransformDriver.java'
--- old/src/com/goldencode/p2j/convert/TransformDriver.java 2025-08-19 11:05:12 +0000
+++ new/src/com/goldencode/p2j/convert/TransformDriver.java 2025-10-07 10:46:06 +0000
@@ -302,37 +302,34 @@
asts,
debug);
- if (mode.schema)
+ // clean up previous run - build schema list and delete those files
+ FileList delDicts = createDatabaseList(".schema", false);
+ deleteFiles(delDicts.listFilenames());
+
+ // build dictionary list
+ dicts = createDatabaseList(".dict", omitSchemaMetadata());
+
+ // fixup dictionary files
+ processTrees("Schema Fixups (data dictionary)",
+ "schema/fixups",
+ datanames,
+ true,
+ dicts,
+ debug);
+
+ // build schema list
+ sdicts = convertSourceNamesToDictNames(".dict");
+
+ // fixup source file schema files (if any exist for these specific
+ // source files)
+ if (sdicts.size() > 0)
{
- // clean up previous run - build schema list and delete those files
- FileList delDicts = createDatabaseList(".schema", false);
- deleteFiles(delDicts.listFilenames());
-
- // build dictionary list
- dicts = createDatabaseList(".dict", omitSchemaMetadata());
-
- // fixup dictionary files
- processTrees("Schema Fixups (data dictionary)",
+ processTrees("Schema Fixups (Progress source file schemas)",
"schema/fixups",
datanames,
true,
- dicts,
+ sdicts,
debug);
-
- // build schema list
- sdicts = convertSourceNamesToDictNames(".dict");
-
- // fixup source file schema files (if any exist for these specific
- // source files)
- if (sdicts.size() > 0)
- {
- processTrees("Schema Fixups (Progress source file schemas)",
- "schema/fixups",
- datanames,
- true,
- sdicts,
- debug);
- }
}
if (mode.callgraph)
@@ -448,13 +445,11 @@
exts.add(".pphints");
}
- if (schema)
- {
- exts.add(".dict");
- exts.add(".schema");
- exts.add(".schema.original");
- exts.add(".p2o");
- }
+ // Even if the schema was not changed, those files will still be created for modified/new files.
+ exts.add(".dict");
+ exts.add(".schema");
+ exts.add(".schema.original");
+ exts.add(".p2o");
// we never delete ".schema.hints" or ".hints" as those are both
// hand-coded configuration files
I tested #10613-1 and the issue is gone. There are no persistent schema changes in this scenario, but the temp-table is modified and this requires the dict, schema and p2o files to be created/updated. The changes above where conditioned by mode.schema, so I added Greg as a watcher for this input on this. I want to figure out another fix to leave the modes intact, but I need to do some brainstorming.
#19 Updated by Dănuț Filimon 10 months ago
I am considering removing:
if(schemasChanged.isEmpty())
{
mode.schema = false;
if (mode instanceof CvtRunMode)
{
((CvtRunMode) mode).skipDBSchema = true;
((CvtRunMode) mode).omitSchemaBrew = true;
}
}
This will have to go because the mode.schema is not representing just the persistent schemas. I am currently experimenting.#20 Updated by Dănuț Filimon 10 months ago
Created 10613a from the latest trunk/16209.
#21 Updated by Dănuț Filimon 10 months ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
- reviewer Greg Shah added
Committed 10613a/16210. Fixed incremental conversion when modifying a temp-table.
Greg, please review.
#22 Updated by Greg Shah 10 months ago
Code Review Task Branch 10613a Revision 16210
Overall the logic seems correct.
schemasChanged == null || !schemasChanged.isEmpty() should be encapsulated into its own protected method hasSchemaChanges() in the TransformDriver. Make sure to add a comment that this will be true for full conversion or if there are any detected permanent schema changes in incremental mode. Then it can be called from all the locations instead of inlining the logic.
#23 Updated by Dănuț Filimon 10 months ago
- Status changed from Review to Internal Test
Committed the hasSchemaChanges() to 10613a/16211.
#25 Updated by Dănuț Filimon 10 months ago
The changes are pretty simple, so the test plan includes running ChUI and a customer conversion/incremental.
#26 Updated by Dănuț Filimon 10 months ago
Dănuț Filimon wrote:
The changes are pretty simple, so the test plan includes running ChUI and a customer conversion/incremental.
Testing passed, 10613a can be merged.
#28 Updated by Dănuț Filimon 10 months ago
- version_resolved set to trunk/16212
- Status changed from Merge Pending to Test
Branch 10613a was merged to trunk rev 16212 and archived.