lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soheb Mahmood <soheb.luc...@gmail.com>
Subject Testing our code for SolrCloud
Date Tue, 07 Dec 2010 20:44:01 GMT
Hello Solr Devs!

My group and I have been working on implementing tasks from the to-do
lists so that we can give something to the SolrCloud open source
community (as we were introduced to it by Upayavira). So far, like my
teammate Alex mentioned, we have all been working on two tasks:

- Optionally allow user to query by collection
- Optionally allow user to query by multiple collections (assume
schemas are compatible)

from the SolrCloud wiki here: http://wiki.apache.org/solr/SolrCloud#TODO.

So far, we have implemented the following code which addresses both of
the above tasks:

// Stores the comma-separated list of specified collections.
// Eg: "collection1,collection2,collection3"
String collections = params.get("collection");
if (collections != null) {
  // If there were one or more collections specified in the query, split each
  // parameter and store as a seperate member of a List.
  List<String> collectionList = StrUtils.splitSmart(collections, ",", true);

  // Get the slices that cover the specified collection.
  // First create an empty HashMap to add the slice info to.
  slices = new HashMap<String, Slice>();

  // In turn, retrieve the slices that cover each collection from the
cloud state
  // and add them to the map 'slices'.
  for (int i = 0; i < collectionList.size(); i++) {
      appendMap(slices, cloudState.getSlices(collectionList.get(i)));
  }
} else {
  // If no collections were specified, default to the collection for this core.
  slices = cloudState.getSlices(cloudDescriptor.getCollectionName());
}

// Store the logical slices in the ResponseBuilder and create a new
// String array to hold the physical shards (which will be mapped later).
rb.slices = slices.keySet().toArray(new String[slices.size()]);
rb.shards = new String[rb.slices.length];
//------------

And we have been "testing" the code by doing acceptance testing
(running the code and seeing if it works the way we would like it to).
So far, we are pretty confident with this code, but we were wondering
if anyone would like to share some comments about what we have
written.

Secondly, we now really want to have some unit tests written for the
code, and we have been admittedly struggling a bit. As of now, we have
just got a test class written so that it essentially starts some
shards, but what we need is a buildZooKeeper method in
AbstractZkTestCase.java that sets up multiple collections and
configurations. Would anybody who has expertise in the testing area
give us a point in the right direction? From what I've seen, there is
the one line of code which has:

zkClient.makePath("/collections/collection1", props1.store(),
CreateMode.PERSISTENT);

so what I was thinking was having more of these lines of code to
represent different collections (e.g. collection2, collection3). Or is
the problem more complicated than that? (I feel like I'm missing
something, like that solution is too simple).

Finally, after we get these to-do lists working, we would like to work
on a higher level design goal. I was wondering if anyone (or any group
of people) are working on a higher level design goal and wanted some
help with it?

Thanks for reading my email,
Soheb

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message