Gerrit + Solr, is there any side effects of ignoring the 'undefined field status' exception about STORED_ONLY and INTEGER_RANGE

49 views
Skip to first unread message

Yang Yang

unread,
Aug 17, 2015, 3:46:59 AM8/17/15
to Repo and Gerrit Discussion
Hi all

I am building a Gerrit site with multiple master java instances, for better availability and load balancing. I have shared rmdbs database, shared repo storage. Now I'm stuck in moving indexing service to Solr.

I use Gerrit 2.10.1 and Solr 4.3.1. Exceptions occurred with below messages when I do gerrit-reindex, `java -jar ./bin/gerrit.war reindex'.
name:_change type:STORED_ONLY
name:deleted type:INTEGER_RANGE

Turned out Gerrit introduced new field types that Solr doesn't support, https://gerrit-review.googlesource.com/#/c/49664/

Then I removed the exception handling code in Gerrit's Solr module. In this file: gerrit-solr/src/main/java/com/google/gerrit/solr/SolrChangeIndex.java
private void add(SolrInputDocument doc, Values<ChangeData> values)
      throws OrmException {
    String name = values.getField().getName();
    FieldType<?> type = values.getField().getType();

    if (type == FieldType.INTEGER) {
      for (Object value : values.getValues()) {
        doc.addField(name, (Integer) value);
      }
    } else if (type == FieldType.LONG) {
      for (Object value : values.getValues()) {
        doc.addField(name, (Long) value);
      }
    } else if (type == FieldType.TIMESTAMP) {
      @SuppressWarnings("deprecation")
      boolean legacy = values.getField() == ChangeField.LEGACY_UPDATED;
      if (legacy) {
        for (Object value : values.getValues()) {
          int t = queryBuilder.toIndexTimeInMinutes((Timestamp) value);
          doc.addField(name, t);
        }
      } else {
        for (Object value : values.getValues()) {
          doc.addField(name, ((Timestamp) value).getTime());
        }
      }
    } else if (type == FieldType.EXACT
        || type == FieldType.PREFIX
        || type == FieldType.FULL_TEXT) {
      for (Object value : values.getValues()) {
        doc.addField(name, (String) value);
      }
    } else {
      throw QueryBuilder.badFieldType(type);
    }
  }

I removed the throw statement. And then Gerrit worked fine.
Just wonders if there is any side effects of ignoring this exception. Would appreciate any insight to this question or any better solution for the index issue. Thanks.

Edwin Kempin

unread,
Aug 17, 2015, 4:15:27 AM8/17/15
to Yang Yang, Repo and Gerrit Discussion
You shouldn't rely on Solr.
Support for Solr is removed in Gerrit 2.12 [1].

[1] https://gerrit-review.googlesource.com/58478

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages