Skip to content

Commit

Permalink
use composite key format for solr core resources; This is a breaking …
Browse files Browse the repository at this point in the history
…change, must reindex or at least re insert solr core info if you are upgrading
  • Loading branch information
tjake committed Nov 14, 2011
1 parent d140f78 commit 7b18f06
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/org/apache/solr/core/SolandraCoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public static ByteBuffer readCoreResource(String coreName, String resourceName)
}

ByteBuffer resourceValue = null;

ByteBuffer coreKey = CassandraUtils.hashKeyBytes(coreName.getBytes("UTF-8"),
CassandraUtils.delimeterBytes, "resources".getBytes("UTF-8"));


ByteBuffer coreNameBytes = ByteBufferUtil.bytes(coreName);
ByteBuffer resourceNameBytes = ByteBufferUtil.bytes(resourceName);
Expand All @@ -250,7 +254,7 @@ public static ByteBuffer readCoreResource(String coreName, String resourceName)
coreNameBytes);

List<Row> rows = CassandraUtils.robustRead(
coreNameBytes,
coreKey,
queryPath,
Arrays.asList(resourceNameBytes),
ConsistencyLevel.QUORUM);
Expand Down Expand Up @@ -294,11 +298,15 @@ public static void writeCoreResource(String coreName, String resourceName, Strin
logger.debug(resourceValue);
}

ByteBuffer coreNameBytes = ByteBufferUtil.bytes(coreName);
ByteBuffer resourceNameBytes = ByteBufferUtil.bytes(resourceName);

RowMutation rm = new RowMutation(CassandraUtils.keySpace, coreNameBytes);
ByteBuffer coreKey = CassandraUtils.hashKeyBytes(coreName.getBytes("UTF-8"),
CassandraUtils.delimeterBytes, "resources".getBytes("UTF-8"));

RowMutation rm = new RowMutation(CassandraUtils.keySpace, coreKey);

ByteBuffer coreNameBytes = ByteBufferUtil.bytes(coreName);
ByteBuffer resourceNameBytes = ByteBufferUtil.bytes(resourceName);

QueryPath queryPath = new QueryPath(
CassandraUtils.schemaInfoColumnFamily,
coreNameBytes,
Expand Down

0 comments on commit 7b18f06

Please sign in to comment.