Skip to content

Commit c619ca6

Browse files
Merge pull request #37 from SAP/develop
Synchronize repository - 2025-01-21 - 1.2.8
2 parents bc72cb1 + 0c96417 commit c619ca6

File tree

69 files changed

+1178
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1178
-447
lines changed

commercedbsync/extensioninfo.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
--><extensioninfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extensioninfo.xsd">
88

99
<extension abstractclassprefix="Generated" classprefix="Commercedbsync" managername="CommercedbsyncManager" managersuperclass="de.hybris.platform.jalo.extension.Extension" name="commercedbsync" usemaven="true">
10-
10+
11+
<requires-extension name="azurecloud"/>
12+
1113
<coremodule generated="true" manager="de.hybris.platform.jalo.extension.GenericManager" packageroot="com.sap.cx.boosters.commercedbsync"/>
12-
14+
1315

1416
</extension>
1517

commercedbsync/external-dependencies.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
<artifactId>commons-dbcp2</artifactId>
2929
<version>2.7.0</version>
3030
</dependency>
31-
<dependency>
32-
<groupId>com.microsoft.azure</groupId>
33-
<artifactId>azure-storage</artifactId>
34-
<version>8.1.0</version>
35-
</dependency>
3631
<dependency>
3732
<groupId>com.zaxxer</groupId>
3833
<artifactId>HikariCP</artifactId>

commercedbsync/project.properties

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,20 @@ migration.schema.target.columns.remove.enabled=true
254254
##
255255
migration.schema.autotrigger.enabled=false
256256
##
257-
# Activate data export to external DB via cron jobs
257+
# Specifies where to store the internal tables
258+
# If empty and migration.data.synchronization.enabled is true, then it is set to "target", otherwise "source"
259+
#
260+
# @values target or source
261+
# @optional true
262+
##
263+
migration.internal.tables.storage=
264+
##
265+
# Activate data synchronization to external DB via cron jobs
258266
#
259267
# @values true or false
260268
# @optional true
261269
##
262-
migration.data.export.enabled=false
270+
migration.data.synchronization.enabled=false
263271
##
264272
# Specifies the number of rows to read per batch. This only affects tables which can be batched.
265273
#
@@ -370,6 +378,13 @@ migration.data.columns.excluded.attributedescriptors=
370378
##
371379
migration.data.columns.nullify.attributedescriptors=
372380
##
381+
# Configure columns to use when reading by offset
382+
#
383+
# @values comma separated list of column names
384+
# @optional true
385+
##
386+
migration.data.columns.batch.TABLE=
387+
##
373388
# If set to true, all indices in the target table will be removed before copying over the data.
374389
#
375390
# @values true or false
@@ -429,13 +444,35 @@ migration.data.tables.excluded=SYSTEMINIT,StoredHttpSessions,itemdeletionmarkers
429444
##
430445
migration.data.tables.included=
431446
##
447+
# Tables to be migrated as first (use table names with prefix and suffix)
448+
#
449+
# @values comma separated list of table full names.
450+
# @optional true
451+
##
452+
migration.data.tables.order.first=
453+
##
454+
# Tables to be migrated as last (use table names with prefix and suffix)
455+
#
456+
# @values comma separated list of table full names.
457+
# @optional true
458+
##
459+
migration.data.tables.order.last=
460+
##
461+
# List of partitioned tables (use table names with prefix and suffix). Separate batches will be created for each table partition.
462+
# This only applies when using HANA as source database.
463+
#
464+
# @values comma separated list of table full names.
465+
# @optional true
466+
##
467+
migration.data.tables.partitioned=
468+
##
432469
# Run migration in the cluster (based on commerce cluster config). The 'HAC' node will be the primary one.
433470
# A scheduling algorithm decides which table will run on which node. Nodes are notified using cluster events.
434471
#
435472
# @values true or false
436473
# @optional true
437474
##
438-
migration.cluster.enabled=false
475+
migration.cluster.enabled=true
439476
##
440477
# If set to true, the migration will resume from where it stopped (either due to errors or cancellation).
441478
#
@@ -502,7 +539,7 @@ migration.data.report.connectionstring=${media.globalSettings.cloudAzureBlobStor
502539
# @values any property key
503540
# @optional true
504541
##
505-
migration.properties.masked=migration.data.report.connectionstring,migration.ds.source.db.password,migration.ds.target.db.password
542+
migration.properties.masked=migration.data.report.connectionstring,migration.ds.source.db.username,migration.ds.source.db.password,migration.ds.target.db.username,migration.ds.target.db.password
506543
##
507544
# Specifies the default locale used.
508545
#
@@ -657,5 +694,3 @@ log4j2.logger.migrationToolkit.name=com.sap.cx.boosters.commercedbsync
657694
log4j2.logger.migrationToolkit.level=INFO
658695
log4j2.logger.migrationToolkit.appenderRef.migration.ref=MigrationAppender
659696
log4j2.logger.migrationToolkit.additivity=false
660-
661-

commercedbsync/resources/commercedbsync-beans.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
<property name="lastColumnValue" type="Object" />
154154
<property name="nextColumnValue" type="Object" />
155155
<property name="batchSize" type="long" />
156+
<property name="partition" type="String" />
156157
</bean>
157158

158159
<bean class="com.sap.cx.boosters.commercedbsync.OffsetQueryDefinition">
@@ -170,6 +171,7 @@
170171
<property name="batchSize" type="long" />
171172
<property name="lowerColumnBoundary" type="Object" />
172173
<property name="upperColumnBoundary" type="Object" />
174+
<property name="partition" type="String" />
173175
</bean>
174176

175177
<bean class="com.sap.cx.boosters.commercedbsync.SeekQueryDefinition">

commercedbsync/resources/commercedbsync-spring.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,22 @@
6060
<constructor-arg name="dataRepositoryFactory" ref="dataRepositoryFactory"/>
6161
<constructor-arg name="dataSourceConfigurationFactory" ref="dataSourceConfigurationFactory"/>
6262
<constructor-arg name="configuration" value="#{configurationService.getConfiguration()}"/>
63+
<constructor-arg name="reversed" value="false"/>
64+
</bean>
65+
66+
<bean name="defaultReversedMigrationContextFactory" class="com.sap.cx.boosters.commercedbsync.context.MigrationContextFactory">
67+
<constructor-arg name="dataRepositoryFactory" ref="dataRepositoryFactory"/>
68+
<constructor-arg name="dataSourceConfigurationFactory" ref="dataSourceConfigurationFactory"/>
69+
<constructor-arg name="configuration" value="#{configurationService.getConfiguration()}"/>
70+
<constructor-arg name="reversed" value="true"/>
6371
</bean>
6472

6573
<alias name="defaultMigrationContext" alias="migrationContext"/>
6674
<bean name="defaultMigrationContext" factory-bean="defaultMigrationContextFactory" factory-method="create"/>
6775

76+
<alias name="defaultReverseIncrementalMigrationContext" alias="reverseIncrementalMigrationContext"/>
77+
<bean name="defaultReverseIncrementalMigrationContext" factory-bean="defaultReversedMigrationContextFactory" factory-method="create"/>
78+
6879
<alias name="defaultMigrationContextValidator" alias="migrationContextValidator"/>
6980
<bean name="defaultMigrationContextValidator" class="com.sap.cx.boosters.commercedbsync.context.validation.impl.DefaultMigrationContextValidator">
7081
<property name="configurationService" ref="configurationService" />
@@ -202,6 +213,7 @@
202213
<property name="configurationService" ref="configurationService" />
203214
<property name="databaseCopyTaskRepository" ref="databaseCopyTaskRepository"/>
204215
<property name="migrationContext" ref="migrationContext"/>
216+
<property name="reverseMigrationContext" ref="reverseIncrementalMigrationContext"/>
205217
<property name="performanceProfiler" ref="performanceProfiler"/>
206218
</bean>
207219

@@ -261,6 +273,7 @@
261273
<property name="migrationContext" ref="migrationContext"/>
262274
<property name="databaseCopyTaskRepository" ref="databaseCopyTaskRepository"/>
263275
<property name="performanceProfiler" ref="performanceProfiler"/>
276+
<property name="reverseMigrationContext" ref="reverseIncrementalMigrationContext"/>
264277
<property name="postProcessors">
265278
<util:list>
266279
<ref bean="migrationPostProcessor"/>
@@ -371,7 +384,15 @@
371384

372385
<bean id="defaultCMTAfterSaveListener" class="com.sap.cx.boosters.commercedbsync.listeners.DefaultCMTAfterSaveListener">
373386
<property name="modelService" ref="modelService" />
374-
<property name="typeService" ref="typeService" />
375387
</bean>
376388

389+
<bean class="com.sap.cx.boosters.commercedbsync.jobs.IncrementalMigrationJob" id="reverseIncrementalMigrationJob"
390+
parent="abstractMigrationJobPerformable">
391+
<property name="migrationContext" ref="reverseIncrementalMigrationContext"/>
392+
</bean>
393+
394+
<bean class="com.sap.cx.boosters.commercedbsync.jobs.FullMigrationJob" id="reverseFullMigrationJob"
395+
parent="abstractMigrationJobPerformable">
396+
<property name="migrationContext" ref="reverseIncrementalMigrationContext"/>
397+
</bean>
377398
</beans>

commercedbsync/resources/impex/projectdata-commercemigration-jobs.impex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
INSERT_UPDATE ServicelayerJob;code[unique=true];springId[unique=true]
33
;incrementalMigrationJob;incrementalMigrationJob
44
;fullMigrationJob;fullMigrationJob
5+
;reverseIncrementalMigrationJob;reverseIncrementalMigrationJob
6+
;reverseFullMigrationJob;reverseFullMigrationJob
57
;migrationPrepJob;migrationPrepJob
68

79
# Update details for incremental migration
@@ -15,24 +17,39 @@ INSERT_UPDATE FullMigrationCronJob;code[unique=true];job(code)[default=fullMigra
1517
;fullDatabaseMigrationJob;;true;true;true;true;true;;mediaformatmapping,cat2attrrellp,categories,compositeentries,mediafolders,mediacontextlp,validationconstraintslp,validationconstraints,catalogslp,units,genericitems,pcp2wrtblecvrel,renderertemplate,dynamiccontent,userrightslp,backofficesearchcond,metainformations,unitslp,workflowactions,productprops,scripts,systemsetupaudit,gentestitems,cat2princrel,jalovelocityrenderer,paymentmodeslp,usergroupprops,orderprops,userrights,workflowactionitemsrel,parserproperty,productfeatures,productreferences,commentcompreadrels,languageslp,syncjob2pcplrel,commentitemrelations,jobs,themes,discounts,catalogversionsyncjob,cat2catrel,categorieslp,syncjob2langrel,currencieslp,impexdocumentids,userprofiles,stdpaymmodevals,links,workflowitematts,products,backofficesavedquery,productslp,workflowtemplatelinkrel,previewtickets,backofficecollections,props,retentionrule,syncjob2typerel,commentcompremoverels,genericitemslp,addresses,catalogs,languages,taxeslp,discountslp,distributedbatches,backofficesavedquerylp,searchrestrictions,aclentries,format2medforrel,keywords,paymentmodes,whereparts,commentassignrelations,commentattachments,discountrows,mediacontainerlp,commentdomains,synattcfg,mediacontext,impbatchcontent,classificationattrslp,commenttypes,globaldiscountrows,mediacontainer,searchrestrictionslp,mediaformatlp,catverdiffs,cmptype2covgrprels,workflowtemplprincrel,clattruntlp,jobslp,titles,pendingstepsrelation,themeslp,countries,commentcompwriterels,processedstepsrelation,slactions,productreferenceslp,usergroups,regionslp,userprops,exportslp,numberseries,distributedprocesses,catalogversions,externalimportkey,usergroupslp,cat2attrrel,medias,jobsearchrestriction,triggerscj,addressprops,openidexternalscopes,attr2valuerel,constraintgroup,renderertemplatelp,titleslp,indextestitem,workflowactionlinkrel,workflowactionslp,catalogversionslp,commentwatchrelations,configitems,pcpl2rdblecvrel,abstrcfgproductinfo,users,workflowitemattslp,commentcompcreaterels,derivedmedias,cat2medrel,scriptslp,regions,currencies,steps,deliverymodeslp,classattrvalueslp,mediaformat,zonedeliverymodevalues,configuratorsettings,prod2keywordrel,cat2prodrel,taxes,cat2keywordrel,classattrvalues,ydeployments,cstrgr2abscstrrel,mediaprops,pgrels,zone2country,classificationattrs,taxrows,renderersproperty,cronjobs,commentcomponents,exports,deliverymodes,comments,workflowactioncomments,countrieslp,commentusersettings,format2comtyprel,corsconfigproperty,backofficecollitemrefs,pricerows,agreements,workflowactionsrel,clattrunt,format,changedescriptors,formatlp,zones
1618
;fullTableMigrationJob;;true;true;false;false;true;;products,paymentmodes
1719

20+
INSERT_UPDATE IncrementalMigrationCronJob; code[unique = true] ; migrationItems; active[default=true]; job(code)[default = reverseIncrementalMigrationJob]; sessionLanguage(isoCode)[default = en]
21+
; reverseIncrementalMigrationJob ; products
22+
23+
INSERT_UPDATE FullMigrationCronJob; code[unique = true] ; truncateEnabled; migrationItems; job(code)[default = reverseFullMigrationJob]; sessionLanguage(isoCode)[default = en]
24+
; reverseFullMigrationJob ; false ; products
25+
1826
INSERT_UPDATE CronJob;code[unique=true];job(code);useReadOnlyDatasource
1927
;migrationPrepCronJob;migrationPrepJob;false
2028

2129
INSERT_UPDATE CompositeEntry;code[unique=true];executableCronJob(code)
2230
;prepForTableMigrationEntry;migrationPrepCronJob
2331
;prepForDbMigrationEntry;migrationPrepCronJob
2432
;prepForIncrementalMigrationEntry;migrationPrepCronJob
33+
;prepForReverseTableMigrationEntry;migrationPrepCronJob
34+
;prepForReverseIncrementalMigrationEntry;migrationPrepCronJob
2535
;migrateDatabaseEntry;fullDatabaseMigrationJob
2636
;migrateTableEntry;fullTableMigrationJob
2737
;migrateIncrementalEntry;incrementalMigrationJob
38+
;reverseMigrateTableEntry;reverseFullMigrationJob
39+
;reverseMigrateIncrementalEntry;reverseIncrementalMigrationJob
2840

2941
INSERT_UPDATE CompositeCronJob;code[unique=true];job(code);sessionLanguage(isoCode)[default=en];
3042
;compositeDatabaseMigrationJob;compositeJobPerformable;
3143
;compositeTableMigrationJob;compositeJobPerformable;
3244
;compositeIncrementalMigrationJob;compositeJobPerformable;
45+
;compositeReverseTableMigrationJob;compositeJobPerformable;
46+
;compositeReverseIncrementalMigrationJob;compositeJobPerformable;
3347

3448
INSERT_UPDATE CompositeCronJob;code[unique=true];compositeEntries(code)[mode = append]
3549
;compositeDatabaseMigrationJob;prepForDbMigrationEntry,migrateDatabaseEntry
3650
;compositeTableMigrationJob;prepForTableMigrationEntry,migrateTableEntry
3751
;compositeIncrementalMigrationJob;prepForIncrementalMigrationEntry,migrateIncrementalEntry
52+
;compositeReverseTableMigrationjob;prepForReverseTableMigrationEntry,reverseMigrateTableEntry
53+
;compositeReverseIncrementalMigrationJob;prepForReverseIncrementalMigrationEntry,reverseMigrateIncrementalEntry
54+
3855

commercedbsync/resources/sql/createSchedulerTablesHANA.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ IF tablename = 'MIGRATIONTOOLKIT_TABLECOPYBATCHES' AND :found > 0
1919
THEN
2020
DROP TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES;
2121
END IF;
22+
23+
IF tablename = 'MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART' AND :found > 0
24+
THEN
25+
DROP TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART;
26+
END IF;
27+
2228
END;
2329
#
2430
CALL MIGRATION_PROCEDURE('MIGRATIONTOOLKIT_TABLECOPYTASKS');
@@ -28,6 +34,7 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYTASKS (
2834
targetnodeId int NOT NULL,
2935
migrationId NVARCHAR(255) NOT NULL,
3036
pipelinename NVARCHAR(255) NOT NULL,
37+
itemorder int NOT NULL DEFAULT 0,
3138
sourcetablename NVARCHAR(255) NOT NULL,
3239
targettablename NVARCHAR(255) NOT NULL,
3340
columnmap NVARCHAR(5000) NULL,
@@ -67,6 +74,21 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES (
6774

6875
#
6976

77+
CALL MIGRATION_PROCEDURE('MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART');
78+
#
79+
80+
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART (
81+
migrationId NVARCHAR(255) NOT NULL,
82+
batchId int NOT NULL DEFAULT 0,
83+
pipelinename NVARCHAR(255) NOT NULL,
84+
lowerBoundary NVARCHAR(255) NOT NULL,
85+
upperBoundary NVARCHAR(255) NULL,
86+
partition VARCHAR(128) NOT NULL,
87+
PRIMARY KEY (migrationid, batchId, pipelinename, partition)
88+
);
89+
90+
#
91+
7092
CALL MIGRATION_PROCEDURE('MIGRATIONTOOLKIT_TABLECOPYSTATUS');
7193
#
7294

commercedbsync/resources/sql/createSchedulerTablesMSSQL.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYTASKS (
55
targetnodeId int NOT NULL,
66
migrationId NVARCHAR(255) NOT NULL,
77
pipelinename NVARCHAR(255) NOT NULL,
8+
itemorder int NOT NULL DEFAULT 0,
89
sourcetablename NVARCHAR(255) NOT NULL,
910
targettablename NVARCHAR(255) NOT NULL,
1011
columnmap NVARCHAR(MAX) NULL,
@@ -39,6 +40,18 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES (
3940
PRIMARY KEY (migrationid, batchId, pipelinename)
4041
);
4142

43+
DROP TABLE IF EXISTS MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART;
44+
45+
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART (
46+
migrationId NVARCHAR(255) NOT NULL,
47+
batchId int NOT NULL DEFAULT 0,
48+
pipelinename NVARCHAR(255) NOT NULL,
49+
lowerBoundary NVARCHAR(255) NOT NULL,
50+
upperBoundary NVARCHAR(255) NULL,
51+
partition VARCHAR(128) NOT NULL,
52+
PRIMARY KEY (migrationid, batchId, pipelinename, partition)
53+
);
54+
4255
DROP TABLE IF EXISTS MIGRATIONTOOLKIT_TABLECOPYSTATUS;
4356

4457
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYSTATUS (

commercedbsync/resources/sql/createSchedulerTablesMYSQL.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYTASKS
55
targetnodeId int NOT NULL,
66
migrationId VARCHAR(255) NOT NULL,
77
pipelinename VARCHAR(255) NOT NULL,
8+
itemorder int NOT NULL DEFAULT 0,
89
sourcetablename VARCHAR(255) NOT NULL,
910
targettablename VARCHAR(255) NOT NULL,
1011
columnmap TEXT NULL,
@@ -40,6 +41,19 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES
4041
PRIMARY KEY (migrationid, batchId, pipelinename)
4142
);
4243
#
44+
DROP TABLE IF EXISTS MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART;
45+
#
46+
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART
47+
(
48+
migrationId VARCHAR(255) NOT NULL,
49+
batchId int NOT NULL DEFAULT 0,
50+
pipelinename VARCHAR(255) NOT NULL,
51+
lowerBoundary VARCHAR(255) NOT NULL,
52+
upperBoundary VARCHAR(255) NULL,
53+
partition VARCHAR(128) NOT NULL,
54+
PRIMARY KEY (migrationid, batchId, pipelinename, partition)
55+
);
56+
#
4357
DROP TABLE IF EXISTS MIGRATIONTOOLKIT_TABLECOPYSTATUS;
4458
#
4559
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYSTATUS

commercedbsync/resources/sql/createSchedulerTablesORACLE.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYTASKS (
1111
targetnodeId number(10) NOT NULL,
1212
migrationId NVARCHAR2(255) NOT NULL,
1313
pipelinename NVARCHAR2(255) NOT NULL,
14+
itemorder int DEFAULT 0 NOT NULL,
1415
sourcetablename NVARCHAR2(255) NOT NULL,
1516
targettablename NVARCHAR2(255) NOT NULL,
1617
columnmap CLOB NULL,
@@ -57,6 +58,27 @@ CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES (
5758

5859

5960

61+
BEGIN
62+
EXECUTE IMMEDIATE 'DROP TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART';
63+
EXCEPTION
64+
WHEN OTHERS THEN NULL;
65+
END;
66+
/
67+
68+
69+
CREATE TABLE MIGRATIONTOOLKIT_TABLECOPYBATCHES_PART (
70+
migrationId NVARCHAR2(255) NOT NULL,
71+
batchId number(10) DEFAULT 0 NOT NULL,
72+
pipelinename NVARCHAR2(255) NOT NULL,
73+
lowerBoundary NVARCHAR2(255) NOT NULL,
74+
upperBoundary NVARCHAR2(255) NULL,
75+
partition VARCHAR(128) NOT NULL,
76+
PRIMARY KEY (migrationid, batchId, pipelinename, partition)
77+
)
78+
/
79+
80+
81+
6082

6183
BEGIN
6284
EXECUTE IMMEDIATE 'DROP TABLE MIGRATIONTOOLKIT_TABLECOPYSTATUS';

0 commit comments

Comments
 (0)