Skip to content

Commit 32ad0b4

Browse files
committed
DS-1723,DS-1841:
* Fix Index IndexWhiteList/getIndexName() BWC Signed-off-by: mchrza <[email protected]>
1 parent a0c5ec6 commit 32ad0b4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

xyz-jobs/xyz-job-steps/src/main/java/com/here/xyz/jobs/steps/impl/DropIndexes.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public void setIndexWhiteList(List<Index> indexWhiteList) {
5959
}
6060

6161
public DropIndexes withIndexWhiteList(List<Index> indexWhiteList) {
62+
for (Index index : indexWhiteList) {
63+
//ensure BWC for spaces created with old index definitions
64+
if(index instanceof OnDemandIndex onDemandIndex && onDemandIndex.definitionGotTransformed()) {
65+
onDemandIndex.setPropertyPath(onDemandIndex.extractLogicalPropertyPath());
66+
}
67+
}
6268
setIndexWhiteList(indexWhiteList);
6369
return this;
6470
}

xyz-util/src/main/java/com/here/xyz/util/db/pg/IndexHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ public boolean definitionGotTransformed() {
232232
@Override
233233
public String getIndexName(String tableName) {
234234
// Take the first 8 characters of md5 hash of the property path
235-
String shortMd5 = DigestUtils.md5Hex(propertyPath).substring(0, 7);
235+
String shortMd5 = DigestUtils.md5Hex(
236+
definitionGotTransformed() ? extractLogicalPropertyPath() : propertyPath
237+
).substring(0, 7);
236238

237239
return idxPrefix + tableName + "_" + shortMd5 + "_m";
238240
}

0 commit comments

Comments
 (0)