Skip to content

Commit 67c297e

Browse files
Really Adding detection for transient generation of invalid json in ChangeFeedStartFromInternal (Azure#20996)
* Really Adding detection for transient generation of invalid json in ChangeFeedStartFromInternal * Fixing StackOverflow error due to unintentional recursion * Addressing test flakiness
1 parent 8520929 commit 67c297e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/test/scala/com/azure/cosmos/spark/PartitionMetadataCacheITest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class PartitionMetadataCacheITest
9696
newStaleCachedItemRefreshPeriodInMsOverride = Some(10 * 1000),
9797
newCachedItemTtlInMsOverride = Some(50))
9898

99-
Thread.sleep(500)
99+
Thread.sleep(2000)
100100
//scalastyle:on magic.number
101101

102102
PartitionMetadataCache.purge(containerConfig, feedRange) shouldEqual false

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/implementation/ChangeFeedStartFromInternal.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ public void populatePropertyBag() {
4343
}
4444

4545
@Override
46-
public String toString()
47-
{
48-
String json = this.toJson();
46+
public String toString() {
47+
return this.toJson();
48+
}
49+
50+
@Override
51+
public String toJson() {
52+
String json = super.toJson();
4953

5054
if (json.indexOf("\"Type\":") != json.lastIndexOf("\"Type\":")) {
5155
// TODO @fabianm Remove as soon as root caused - https://github.com/Azure/azure-sdk-for-java/issues/20635
56+
// "StartFrom":{"Type":"NOW","Type":"NOW"}
5257
throw new IllegalStateException("There shouldn't be any duplicate json properties!");
5358
}
5459

0 commit comments

Comments
 (0)