You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ge...@apache.org on 2020/04/01 12:56:20 UTC
[lucene-solr] branch branch_8x updated: SOLR-14363: Separate /get
requests into their own type designation (#1379)
This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new e463934 SOLR-14363: Separate /get requests into their own type designation (#1379)
e463934 is described below
commit e463934ab190dd9950616130897f477f7d1e72f8
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Wed Apr 1 08:41:48 2020 -0400
SOLR-14363: Separate /get requests into their own type designation (#1379)
---
.../java/org/apache/solr/util/SolrLogPostTool.java | 20 ++++++++++++++++----
.../org/apache/solr/util/SolrLogPostToolTest.java | 20 ++++++++++++++++++++
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/util/SolrLogPostTool.java b/solr/core/src/java/org/apache/solr/util/SolrLogPostTool.java
index d6e06f2..24a2ba6 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrLogPostTool.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrLogPostTool.java
@@ -28,6 +28,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.SolrInputField;
/**
@@ -277,6 +278,9 @@ public class SolrLogPostTool {
doc.addField("qtime_i", parseQTime(line));
doc.addField("status_s", parseStatus(line));
+ String path = parsePath(line);
+ doc.addField("path_s", path);
+
if(line.contains("hits=")) {
doc.addField("hits_l", parseHits(line));
}
@@ -291,12 +295,13 @@ public class SolrLogPostTool {
doc.addField("shard_s", parseShard(line));
doc.addField("replica_s", parseReplica(line));
- String path = parsePath(line);
- doc.addField("path_s", path);
+
if(path != null && path.contains("/admin")) {
doc.addField("type_s", "admin");
} else if(path != null && params.contains("/replication")) {
doc.addField("type_s", "replication");
+ } else if (path != null && path.contains("/get")) {
+ doc.addField("type_s", "get");
} else {
doc.addField("type_s", "query");
}
@@ -493,11 +498,10 @@ public class SolrLogPostTool {
doc.addField("shards_s", "true");
}
- if(parts[0].equals("ids")) {
+ if(parts[0].equals("ids") && ! isRTGRequest(doc)) {
doc.addField("ids_s", "true");
}
-
if (parts[0].equals("wt")) {
String dr = URLDecoder.decode(parts[1], "UTF-8");
doc.addField("wt_s", dr);
@@ -529,5 +533,13 @@ public class SolrLogPostTool {
doc.addField("ids_s", "false");
}
}
+
+ private boolean isRTGRequest(SolrInputDocument doc) {
+ final SolrInputField path = doc.getField("path_s");
+ if (path == null) return false;
+
+
+ return "/get".equals(path.getValue());
+ }
}
}
\ No newline at end of file
diff --git a/solr/core/src/test/org/apache/solr/util/SolrLogPostToolTest.java b/solr/core/src/test/org/apache/solr/util/SolrLogPostToolTest.java
index 034c380..9f9322a 100644
--- a/solr/core/src/test/org/apache/solr/util/SolrLogPostToolTest.java
+++ b/solr/core/src/test/org/apache/solr/util/SolrLogPostToolTest.java
@@ -69,7 +69,27 @@ public class SolrLogPostToolTest extends SolrTestCaseJ4 {
assertEquals(isShard.getValue(), "true");
assertEquals(ids.getValue(), "false");
assertEquals(shards.getValue(), "false");
+ }
+
+ @Test
+ public void testRTGRecord() throws Exception {
+ final String record = "2020-03-19 20:00:30.845 INFO (qtp1635378213-20354) [c:logs4 s:shard8 r:core_node63 x:logs4_shard8_replica_n60] o.a.s.c.S.Request [logs4_shard8_replica_n60] webapp=/solr path=/get params={qt=/get&_stateVer_=logs4:104&ids=id1&ids=id2&ids=id3&wt=javabin&version=2} status=0 QTime=61";
+
+ List<SolrInputDocument> docs = readDocs(record);
+ assertEquals(docs.size(), 1);
+ SolrInputDocument doc = docs.get(0);
+ assertEquals(doc.getField("type_s").getValue(), "get");
+ assertEquals(doc.getField("date_dt").getValue(), "2020-03-19T20:00:30.845");
+ assertEquals(doc.getField("collection_s").getValue(), "logs4");
+ assertEquals(doc.getField("path_s").getValue(), "/get");
+ assertEquals(doc.getField("status_s").getValue(), "0");
+ assertEquals(doc.getField("shard_s").getValue(), "shard8");
+ assertEquals(doc.getField("replica_s").getValue(), "core_node63");
+ assertEquals(doc.getField("core_s").getValue(), "logs4_shard8_replica_n60");
+ assertEquals(doc.getField("wt_s").getValue(), "javabin");
+ assertEquals(doc.getField("distrib_s").getValue(), "true");
+ assertEquals(doc.getField("ids_s").getValue(), "false");
}
@Test