You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "markrmiller (via GitHub)" <gi...@apache.org> on 2023/06/09 20:04:46 UTC

[GitHub] [solr-sandbox] markrmiller commented on a diff in pull request #61: Add additional unsupported options for delete-by-query.

markrmiller commented on code in PR #61:
URL: https://github.com/apache/solr-sandbox/pull/61#discussion_r1224718992


##########
crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateProcessor.java:
##########
@@ -127,58 +125,82 @@ private UpdateRequest createAndOrGetMirrorRequest() {
       log.debug("processAdd isLeader={} cmd={}", isLeader, cmd);
   }
 
-  @Override public void processDelete(final DeleteUpdateCommand cmd) throws IOException {
-    if (doMirroring && !cmd.isDeleteById() && !"*:*".equals(cmd.query)) {
+  @Override
+  public void processDelete(final DeleteUpdateCommand cmd) throws IOException {
+    String dbqMethod = cmd.getReq().getParams().get("dbqMethod");
+    if (dbqMethod == null) {
+      dbqMethod = defaultDefaultDBQMethod;
+    }
 
-      CloudDescriptor cloudDesc =
-          cmd.getReq().getCore().getCoreDescriptor().getCloudDescriptor();
+    if (doMirroring && !cmd.isDeleteById() && !"*:*".equals(cmd.query)) {
+      CloudDescriptor cloudDesc = cmd.getReq().getCore().getCoreDescriptor().getCloudDescriptor();
       String collection = cloudDesc.getCollectionName();
-
       HttpClient httpClient = cmd.getReq().getCore().getCoreContainer().getUpdateShardHandler().getDefaultHttpClient();
 
-      try (HttpSolrClient client =
-          new HttpSolrClient.Builder(cmd.getReq().getCore().getCoreContainer().getZkController().getBaseUrl()).withHttpClient(httpClient).build()) {
-
+      try (HttpSolrClient client = new HttpSolrClient.Builder(cmd.getReq().getCore().getCoreContainer().getZkController().getBaseUrl()).withHttpClient(httpClient).build()) {
         String uniqueField = cmd.getReq().getSchema().getUniqueKeyField().getName();
 
-        int rows = Integer.getInteger("solr.crossdc.dbq_rows", 1000);
-        SolrQuery q = new SolrQuery(cmd.query).setRows(rows).setSort(SolrQuery.SortClause.asc(uniqueField)).setFields(uniqueField);
-        String cursorMark = CursorMarkParams.CURSOR_MARK_START;
-
-        int cnt = 1;
-        boolean done = false;
-        while (!done) {
-          q.set(CursorMarkParams.CURSOR_MARK_PARAM, cursorMark);
-          QueryResponse rsp =
-              client.query(collection, q);
-          String nextCursorMark = rsp.getNextCursorMark();
-
-          if (log.isDebugEnabled()) {
-            log.debug("resp: cm={}, ncm={}, cnt={}, results={} ", cursorMark, nextCursorMark, cnt,
-                rsp.getResults());
-            cnt++;
+        if (dbqMethod == null || dbqMethod.equals("default")) {
+
+          int rows = Integer.getInteger("solr.crossdc.dbq_rows", 1000);
+          SolrQuery q = new SolrQuery(cmd.query).setRows(rows).setSort(SolrQuery.SortClause.asc(uniqueField)).setFields(uniqueField);
+          String cursorMark = CursorMarkParams.CURSOR_MARK_START;
+
+          int cnt = 1;
+          boolean done = false;
+          while (!done) {
+            q.set(CursorMarkParams.CURSOR_MARK_PARAM, cursorMark);
+            QueryResponse rsp =
+                    client.query(collection, q);
+            String nextCursorMark = rsp.getNextCursorMark();
+
+            if (log.isDebugEnabled()) {
+              log.debug("resp: cm={}, ncm={}, cnt={}, results={} ", cursorMark, nextCursorMark, cnt,
+                      rsp.getResults());
+              cnt++;
+            }
+
+            processDBQResults(client, collection, uniqueField, rsp);
+            if (cursorMark.equals(nextCursorMark)) {
+              done = true;
+            }
+            cursorMark = nextCursorMark;
           }
-
-          processDBQResults(client, collection, uniqueField, rsp);
-          if (cursorMark.equals(nextCursorMark)) {
-            done = true;
+        } else if (dbqMethod.equals("convert_no_paging")) {
+          int rows = 10000;
+          SolrQuery q = new SolrQuery(cmd.query).setRows(rows).setFields(uniqueField);

Review Comment:
   I think that could make a good additional option, but given it's an optional endpoint, I don't think it should replace a built in option. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org