From 0c694b3d19d9c3b54fca2fc92bbefe7f6622ae87 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Wed, 11 Jan 2017 09:22:24 -0800 Subject: [PATCH] Update loop counter to be higher (1000000) instead of (10000). --- .../org/elasticsearch/painless/CompilerSettings.java | 12 +++++++----- .../painless/WhenThingsGoWrongTests.java | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java index 9ef1b2ccf12..378cca7f58f 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java @@ -41,7 +41,7 @@ public final class CompilerSettings { * Constant to be used for enabling additional internal compilation checks (slower). */ public static final String PICKY = "picky"; - + /** * For testing: do not use. */ @@ -49,15 +49,17 @@ public final class CompilerSettings { /** * The maximum number of statements allowed to be run in a loop. + * For now the number is set fairly high to accommodate users + * doing large update queries. */ - private int maxLoopCounter = 10000; + private int maxLoopCounter = 1000000; /** * Whether to throw exception on ambiguity or other internal parsing issues. This option * makes things slower too, it is only for debugging. */ private boolean picky = false; - + /** * For testing. Do not use. */ @@ -102,7 +104,7 @@ public final class CompilerSettings { public void setPicky(boolean picky) { this.picky = picky; } - + /** * Returns initial call site depth. This means we pretend we've already seen N different types, * to better exercise fallback code in tests. @@ -110,7 +112,7 @@ public final class CompilerSettings { public int getInitialCallSiteDepth() { return initialCallSiteDepth; } - + /** * For testing megamorphic fallbacks. Do not use. * @see #getInitialCallSiteDepth() diff --git a/modules/lang-painless/src/test/java/org/elasticsearch/painless/WhenThingsGoWrongTests.java b/modules/lang-painless/src/test/java/org/elasticsearch/painless/WhenThingsGoWrongTests.java index 4051d8457fa..aaa337ae821 100644 --- a/modules/lang-painless/src/test/java/org/elasticsearch/painless/WhenThingsGoWrongTests.java +++ b/modules/lang-painless/src/test/java/org/elasticsearch/painless/WhenThingsGoWrongTests.java @@ -148,10 +148,10 @@ public class WhenThingsGoWrongTests extends ScriptTestCase { public void testLoopLimits() { // right below limit: ok - exec("for (int x = 0; x < 9999; ++x) {}"); + exec("for (int x = 0; x < 999999; ++x) {}"); PainlessError expected = expectScriptThrows(PainlessError.class, () -> { - exec("for (int x = 0; x < 10000; ++x) {}"); + exec("for (int x = 0; x < 1000000; ++x) {}"); }); assertTrue(expected.getMessage().contains( "The maximum number of statements that can be executed in a loop has been reached."));