From 7e1f8b43a92203b3f64ad939c9021da7a0c7e090 Mon Sep 17 00:00:00 2001 From: Mikhail Khludnev Date: Wed, 20 Nov 2024 13:18:37 +0300 Subject: [PATCH] nuke comment Signed-off-by: Mikhail Khludnev --- .../search/SearchIpFieldTermsTests.java | 91 ------------------- 1 file changed, 91 deletions(-) diff --git a/server/src/test/java/org/opensearch/search/SearchIpFieldTermsTests.java b/server/src/test/java/org/opensearch/search/SearchIpFieldTermsTests.java index 8c7f18826b243..3aa712b9dfa72 100644 --- a/server/src/test/java/org/opensearch/search/SearchIpFieldTermsTests.java +++ b/server/src/test/java/org/opensearch/search/SearchIpFieldTermsTests.java @@ -150,97 +150,6 @@ private static String dumpException(OpenSearchException ose) { return out.toString(); } - // public void testMassive() throws Exception { - // XContentBuilder xcb = createMapping(); - // client().admin().indices().prepareCreate(defaultIndexName).setMapping(xcb).get(); - // ensureGreen(); - // - // BulkRequestBuilder bulkRequestBuilder = client().prepareBulk(); - // - // Set dedupeCidrs = new HashSet<>(); - // int cidrs = 0; - // int ips = 0; - // List toQuery = new ArrayList<>(); - // for (int i = 0; ips <= 10240 && cidrs <= IndexSearcher.getMaxClauseCount()+10 && i < 1000000; i++) { - // String ip; - // int prefix; - // boolean mask; - // do{ - // mask = random().nextBoolean(); - // ip = generateRandomIPv4(); - // prefix = 24 + random().nextInt(8); // CIDR prefix for IPv4 - // }while(mask && !dedupeCidrs.add(getFirstThreeOctets(ip))); - // - // bulkRequestBuilder.add(client().prepareIndex(defaultIndexName). - // setSource(Map.of("addr", ip, "dummy_filter", randomSubsetOf(1,"1","2","3")))); - // - // final String termToQuery; - // if (random().nextBoolean()) { - // termToQuery = ip + "/" + prefix; - // cidrs++; - // } else { - // termToQuery = ip; - // ips++; - // } - // toQuery.add(termToQuery); - // - // if (cidrs == IndexSearcher.getMaxClauseCount()-1) { - // bulkRequestBuilder.setRefreshPolicy(IMMEDIATE).get(); - // bulkRequestBuilder = client().prepareBulk(); - // long expectedMatches = (long) cidrs + ips ; - // assertTermsHitCount("addr.dv", toQuery, expectedMatches); - // // after this passed add dummy filter - // assertTermsHitCount("addr.dv", toQuery, expectedMatches, (boolBuilder)->{ - // boolBuilder.filter(QueryBuilders.termsQuery("dummy_filter","1","2","3")) - // .filter(QueryBuilders.termsQuery("dummy_filter","1","2","3","4")) - // .filter(QueryBuilders.termsQuery("dummy_filter","1","2","3","4","5")); - // }); - // } - // if (cidrs == IndexSearcher.getMaxClauseCount()) {// this exceeds clauses precondition - // bulkRequestBuilder.setRefreshPolicy(IMMEDIATE).get(); - // bulkRequestBuilder = client().prepareBulk(); - // long expectedMatches = (long) cidrs + ips ; - // assertTermsHitCount("addr.dv", toQuery, expectedMatches); - // } - // } - // int addMatches = 0; - // for (int i = 0; i < atLeast(100); i++) { - // final String ip; - // ip = generateRandomIPv4(); - // bulkRequestBuilder.add(client().prepareIndex(defaultIndexName).setSource(Map.of("addr", ip, - // "dummy_filter", randomSubsetOf(1,"1","2","3")))); - // boolean match = false; - // for (String termQ : toQuery) { - // boolean isCidr = termQ.contains("/"); - // if ((isCidr && isIPInCIDR(ip, termQ)) || (!isCidr && termQ.equals(ip))) { - // match = true; - // break; - // } - // } - // if (match) { - // addMatches++; - // } else { - // break; // single mismatch is enough. - // } - // } - // - // bulkRequestBuilder.setRefreshPolicy(IMMEDIATE).get(); - // long expectedMatches = (long) cidrs + ips + addMatches; - // for (String field : List.of("addr", "addr.idx" /*"addr.dv"*/)) { - // assertTermsHitCount(field, toQuery, expectedMatches); - // } - // - // try { - // assertTermsHitCount("addr.dv", toQuery, expectedMatches); - // fail(); - // }catch (SearchPhaseExecutionException tmc) { - // Throwable cause = tmc.shardFailures()[0].getCause().getCause(); - // assertTrue (cause instanceof IndexSearcher.TooManyClauses); - // assertTrue(cause.getMessage().contains("IP")); - // assertTrue(cause.getMessage().contains("masks")); - // } - // } - public static String getFirstThreeOctets(String ipAddress) { // Split the IP address by the dot delimiter String[] octets = ipAddress.split("\\.");