JanusGraph / JanusGraph/janusgraph

mixed index with SolrCloud returns inconsistent results

Open
#1,936 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

index/solr kind/bug/possible
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

Using SolrCloud with 2 nodes, and a mixed index with 2 shards and replication factor of 2, the streaming result can end up with duplicates.

This behavior was not witnessed in these configurations:
* Solr Standalone
* SolrCloud with 1 node, mixed index with 1 shard, RF=1
* SolrCloud with 1 node, mixed index with 1 shard, RF=2
* SolrCloud with 1 node, mixed index with 2 shard, RF=1
* SolrCloud with 1 node, mixed index with 2 shard, RF=2
* SolrCloud with 2 nodes, mixed index with 1 shard, RF=1
* SolrCloud with 2 nodes, mixed index with 1 shard, RF=2
* SolrCloud with 2 nodes, mixed index with 2 shard, RF=1

- Version: JanusGraph 0.3.1, 0.3.3, 0.4.0
- Storage Backend: berkeleyje
- Mixed Index Backend: solr 7.4.0, 7.7.2
- Steps to Reproduce:

janusgraph.properties

```
storage.backend=berkeleyje
storage.directory=db/berkeleyje

index.search.backend=solr
index.search.solr.mode=cloud
index.search.solr.zookeeper-url=localhost:2181
index.search.solr.configset=janusgraph_configs
index.search.solr.num-shards=2
index.search.solr.replication-factor=2
index.search.solr.max-shards-per-node=4
# default max-result-set-size is 50
index.search.max-result-set-size=2
```

Schema and index definition

```
final PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SINGLE).make();
final JanusGraphIndex nameIndex = mgmt.buildIndex("nameIndex", Vertex.class).addKey(name).buildMixedIndex(indexName);
```

Graph initialization (10 vertices)

```
for (int i=0; i<10; i++) {
g.addV().property("name", "solr").next();
}
g.tx().commit();
```

Query against mixed index

```
g.tx().rollback();
List list = g.V().has("name", "solr").toList();
g.tx().rollback();
Set set = new TreeSet<>();
for (Vertex v : list) {
set.add(v);
}
System.out.println(list.size() == set.size());
```

The query will return sometimes return fewer than 10 vertices. If you increase the value of `index.search.max-result-set-size` to something larger than the expected number of results, then the mixed index query returns the correct number.

I observed that the query sent to Solr has no ordering involved. I suspect that because there is no sort order, the results are returned in an indeterminate order. When the results are coming back from multiple nodes across multiple shards, the likelihood of getting a duplicate increases.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the supplied janusgraph.properties configuration, mixed-index definition, and query against a two-node, two-shard, RF=2 SolrCloud setup. Compare the returned vertices with the expected 10 and inspect the generated Solr query, including its lack of ordering; done means the query consistently returns all vertices without duplicates in the reported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, distributed-systems, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.