Skip to content
Permalink
Browse files
OAK-9751 : handled cases where path changes in lucene exceeds max bui…
…lder size
  • Loading branch information
Rishabh Kumar committed Apr 25, 2022
1 parent 6ca4dd7 commit 0d95ce7be84b7ad901f50efa9f7bcc948a959e8f
Showing 2 changed files with 21 additions and 0 deletions.
@@ -93,6 +93,9 @@ public void addSerializedProperty(@Nullable String json) {
}
if (sizeWithinLimits()) {
indexedNodes.put(path, reader.readString());
} else {
// return if max limit reached for builder to avoid overflow exception
return;
}
}
} while (reader.matches(','));
@@ -53,7 +53,25 @@ public void nullOrEmptyJson() throws Exception{

assertTrue(Iterables.isEmpty(((IndexedPaths)builder2.build())));
}
@Test
public void addJsonLessThanMaxBuilderSize() throws Exception {
String a = null;
for (int i = 0; i < 499; i++) {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 998);
}

@Test
public void addJsonBiggerThanMaxBuilderSize() throws Exception {
String a = null;
for (int i = 0; i < 502; i++) {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 1000);
}
@Test
public void addMulti() throws Exception{
LuceneDocumentHolder h1 = createHolder();

0 comments on commit 0d95ce7

Please sign in to comment.