You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/03/02 22:00:24 UTC
svn commit: r918177 - in /directory/sandbox/seelmann/hbase-partition/src:
main/java/org/apache/directory/server/core/partition/hbase/cursor/
main/java/org/apache/directory/server/core/partition/hbase/table/
test/java/org/apache/directory/server/core/pa...
Author: seelmann
Date: Tue Mar 2 21:00:23 2010
New Revision: 918177
URL: http://svn.apache.org/viewvc?rev=918177&view=rev
Log:
Improved index scans
Modified:
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java
directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java Tue Mar 2 21:00:23 2010
@@ -40,7 +40,6 @@
import org.apache.hadoop.hbase.filter.RegexStringComparator;
import org.apache.hadoop.hbase.filter.RowFilter;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
-import org.apache.hadoop.hbase.util.Bytes;
/**
@@ -170,11 +169,12 @@
{
/*
* this case is relevant for substring filters with an initial pattern, e.g. (cn=test*)
+ * - start row is "=test"
+ * - stop row is "=tesu" ("=test"+ one bit)
* - row filter is "^=test.*$"
*/
start = indexTable.getScanKey( node.getInitial() );
- stop = Bytes.add( indexTable.getScanKey( node.getInitial() ), new byte[]
- { ( byte ) 0xFF } );
+ stop = Utils.incrementBytes( start );
rowFilterPattern = Pattern.compile( "^=" + Utils.getValuePattern( node, store ) + "$" );
}
else
@@ -182,10 +182,12 @@
/*
* this case is relevant for substring filters w/o an initial pattern, e.g. (cn=*test*)
* unfortunately we need to scan the whole index, but can set a row filter
+ * - start row is "="
+ * - stop row is ">" ("=" + 1 bit)
* - row filter is "^=.*test.*$"
*/
- start = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
+ start = indexTable.getScanKey( null );
+ stop = Utils.incrementBytes( start );
rowFilterPattern = Pattern.compile( "^=" + Utils.getValuePattern( node, store ) + "$" );
}
}
@@ -194,10 +196,11 @@
/*
* this case is relevant for greater than filters (the start value is set by before(IndexEntry)), e.g. (cn>=test)
* - start row is "=test"
- * - stop row is "=0xFF"
+ * - stop row is ">" ("=" + 1 bit)
*/
start = indexTable.getScanKey( value );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
+ stop = indexTable.getScanKey( null );
+ stop = Utils.incrementBytes( stop );
// TODO: is it possible to use the LdapComparator for the row filter?
rowFilterPattern = null;
}
@@ -206,11 +209,13 @@
/*
* this case is relevant for less than filters, e.g. (cn<=test)
* unfortunately we need to scan the whole index
- * - start row is "=0x00"
- * - stop row is "=0xFF"
+ * - start row is "="
+ * - stop row is "=tesu" ("=test" + 1 bit)
*/
- start = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
+ start = indexTable.getScanKey( null );
+ stop = indexTable.getScanKey( value );
+ stop = Utils.incrementBytes( stop );
+ //stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
// TODO: is it possible to use the LdapComparator for the row filter?
rowFilterPattern = null;
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java Tue Mar 2 21:00:23 2010
@@ -88,14 +88,15 @@
/*
* this case is relevant for equal filters, e.g. (cn=test)
* we exactly set the bound of the scanner:
- * - start row is "=test\00<VALUE_SCAN_START>"
- * - stop row is "=test\00<VALUE_SCAN_STOP>"
- * - row filter is "^=test\00[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$"
+ * - start row is "=test\00"
+ * - stop row is "=test\01" ("=test\00" + 1 bit)
+ * (- row filter is "^=test\00[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$")
*/
- start = indexTable.getScanKey( value, HBaseIndexTable.DELIMITER, HBaseIndexTable.VALUE_SCAN_START );
- stop = indexTable.getScanKey( value, HBaseIndexTable.DELIMITER, HBaseIndexTable.VALUE_SCAN_STOP );
- rowFilterPattern = Pattern.compile( "^=" + Pattern.quote( "" + value ) + Pattern.quote( "\00" )
- + "[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$" );
+ start = indexTable.getScanKey( value, HBaseIndexTable.DELIMITER );
+ stop = Utils.incrementBytes( start );
+ rowFilterPattern = null;
+ // rowFilterPattern = Pattern.compile( "^=" + Pattern.quote( "" + value ) + Pattern.quote( "\00" )
+ // + "[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$" );
}
else if ( node != null )
{
@@ -103,14 +104,12 @@
{
/*
* this case is relevant for substring filters with an initial pattern, e.g. (cn=test*)
- * - start row is "=test\00"
- * - stop row is "=test\FF"
+ * - start row is "=test"
+ * - stop row is "=tesu" ("=test" + 1 bit)
* - row filter is "^=test.*\00[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$"
*/
- start = indexTable.getScanKey( node.getInitial(), HBaseIndexTable.FULL_SCAN_START, null );
- stop = indexTable.getScanKey( node.getInitial(), HBaseIndexTable.FULL_SCAN_STOP, null );
- //start = new byte[0];
- //stop = new byte[0];
+ start = indexTable.getScanKey( node.getInitial(), null );
+ stop = Utils.incrementBytes( start );
rowFilterPattern = Pattern.compile( "^=" + Utils.getValuePattern( node, store )
+ Pattern.quote( "\00" )
+ "[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$" );
@@ -120,12 +119,12 @@
/*
* this case is relevant for substring filters w/o an initial pattern, e.g. (cn=*test*)
* unfortunately we need to scan the whole index, but can set a row filter
- * - start row is "=\00"
- * - stop row is "=\FF"
+ * - start row is "="
+ * - stop row is ">" ("=" + 1 bit)
* - row filter is "^=.*test.*\00[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$"
*/
- start = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, null, null );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, null, null );
+ start = indexTable.getScanKey( null, null );
+ stop = Utils.incrementBytes( start );
rowFilterPattern = Pattern.compile( "^=" + Utils.getValuePattern( node, store )
+ Pattern.quote( "\00" )
+ "[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$" );
@@ -135,11 +134,12 @@
{
/*
* this case is relevant for greater than filters (the start value is set by before(IndexEntry)), e.g. (cn>=test)
- * - start row is "=test\00"
- * - stop row is "=\FF"
+ * - start row is "=test"
+ * - stop row is ">" ("=" + 1 bit)
*/
- start = indexTable.getScanKey( value, HBaseIndexTable.DELIMITER, null );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, null, null );
+ start = indexTable.getScanKey( value, null );
+ stop = indexTable.getScanKey( null, null );
+ stop = Utils.incrementBytes( stop );
// TODO: is it possible to use the LdapComparator for the row filter?
rowFilterPattern = null;
}
@@ -148,11 +148,12 @@
/*
* this case is relevant for less than filters, e.g. (cn<=test)
* unfortunately we need to scan the whole index
- * - start row is "=\00"
- * - stop row is "=\FF"
+ * - start row is "="
+ * - stop row is "=tesu" ("=test" + 1 bit)
*/
- start = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, null, null );
- stop = indexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, null, null );
+ start = indexTable.getScanKey( null, null );
+ stop = indexTable.getScanKey( value, null );
+ stop = Utils.incrementBytes( stop );
// TODO: is it possible to use the LdapComparator for the row filter?
rowFilterPattern = null;
}
@@ -179,17 +180,12 @@
while ( iterator.hasNext() )
{
Result next = iterator.next();
- //byte[] row = next.getRow();
+ UUID id = indexTable.extractEntryIdFromEqualsKey( next.getRow() );
Object value = indexTable.extractValueFromEqualsKey( next.getRow() );
- if ( value != null )
- {
- byte[] id = next.getValue( HBaseIndexTable.INFO_FAMILY, HBaseIndexTable.ID_QUALIFIER );
-
- currentEntry = new ForwardIndexEntry<Object, ServerEntry, UUID>();
- currentEntry.setId( Utils.toUUID( id ) );
- currentEntry.setValue( value );
- return true;
- }
+ currentEntry = new ForwardIndexEntry<Object, ServerEntry, UUID>();
+ currentEntry.setId( id );
+ currentEntry.setValue( value );
+ return true;
}
return false;
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java Tue Mar 2 21:00:23 2010
@@ -119,17 +119,7 @@
bb.append( '=' );
- // add value
- // there are special values to support attribute scan
- if ( value == FULL_SCAN_START )
- {
- bb.append( FULL_SCAN_START );
- }
- else if ( value == FULL_SCAN_STOP )
- {
- bb.append( FULL_SCAN_STOP );
- }
- else if ( value != null )
+ if ( value != null )
{
byte[] normValue = getNormalized( value );
bb.append( normValue );
@@ -235,7 +225,7 @@
// exact match (attribute=value): =value -> id
byte[] equalsKey = getEqualsKey( value );
Put exactPut = new Put( equalsKey );
- exactPut.add( INFO_FAMILY, Utils.toBytes( id ), Utils.toBytes( id ) );
+ exactPut.add( INFO_FAMILY, Utils.toBytes( id ), DUMMY );
HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
// TODO: optimize - don't need to clear the áºhole cache
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java Tue Mar 2 21:00:23 2010
@@ -38,12 +38,9 @@
public static final byte[] INFO_FAMILY = Bytes.toBytes( "info" );
public static final byte[] ID_QUALIFIER = Bytes.toBytes( "id" );
- public static final UUID VALUE_SCAN_START = UUID.fromString( "00000000-0000-0000-0000-000000000000" );
- public static final UUID VALUE_SCAN_STOP = UUID.fromString( "ffffffff-ffff-ffff-ffff-ffffffffffff" );
-
+ public static final byte[] DUMMY =
+ { 0x00 };
public static final Byte DELIMITER = Byte.valueOf( ( byte ) 0x00 );
- public static final Byte FULL_SCAN_START = Byte.valueOf( ( byte ) 0x00 );
- public static final Byte FULL_SCAN_STOP = Byte.valueOf( ( byte ) 0xFF );
public abstract void close() throws Exception;
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java Tue Mar 2 21:00:23 2010
@@ -93,23 +93,13 @@
}
- public byte[] getScanKey( Object value, Byte delimiter, UUID entryId ) throws Exception
+ public byte[] getScanKey( Object value, Byte delimiter ) throws Exception
{
ByteBuffer bb = new ByteBuffer();
bb.append( '=' );
- // add value
- // there are special values to support attribute scan
- if ( value == FULL_SCAN_START )
- {
- bb.append( FULL_SCAN_START.byteValue() );
- }
- else if ( value == FULL_SCAN_STOP )
- {
- bb.append( FULL_SCAN_STOP.byteValue() );
- }
- else if ( value != null )
+ if ( value != null )
{
byte[] normValue = getNormalized( value );
bb.append( normValue );
@@ -120,20 +110,6 @@
bb.append( delimiter.byteValue() );
}
- // add entryId
- if ( entryId == VALUE_SCAN_START )
- {
- bb.append( Bytes.toBytes( VALUE_SCAN_START.toString() ) );
- }
- else if ( entryId == VALUE_SCAN_STOP )
- {
- bb.append( Bytes.toBytes( VALUE_SCAN_STOP.toString() ) );
- }
- else if ( entryId != null )
- {
- bb.append( Bytes.toBytes( entryId.toString() ) );
- }
-
return bb.copyOfUsedBytes();
}
@@ -147,6 +123,14 @@
}
+ public UUID extractEntryIdFromEqualsKey( byte[] row ) throws Exception
+ {
+ byte[] id = Bytes.tail( row, 36 );
+ UUID uuid = Utils.toUUID( id );
+ return uuid;
+ }
+
+
/* (non-Javadoc)
* @see org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable#count(java.lang.Object)
*/
@@ -205,7 +189,7 @@
// exact match (attribute=value): =value<0x00><id> -> id, value
byte[] exactRow = getEqualsKey( value, id );
Put exactPut = new Put( exactRow );
- exactPut.add( INFO_FAMILY, ID_QUALIFIER, Utils.toBytes( id ) );
+ exactPut.add( INFO_FAMILY, ID_QUALIFIER, DUMMY );
HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
// TODO: optimize - don't need to clear the áºhole cache
Modified: directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java?rev=918177&r1=918176&r2=918177&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableTest.java Tue Mar 2 21:00:23 2010
@@ -29,6 +29,7 @@
import java.util.UUID;
import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.partition.hbase.Utils;
import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
import org.apache.hadoop.hbase.client.Delete;
@@ -148,8 +149,7 @@
NavigableMap<byte[], byte[]> equalInfoMap = equalResult.getFamilyMap( Bytes.toBytes( "info" ) );
assertNotNull( equalInfoMap );
assertEquals( 1, equalInfoMap.size() );
- assertEquals( "00000000-0000-0000-0000-000000000001", Bytes
- .toString( equalInfoMap.get( Bytes.toBytes( "id" ) ) ) );
+ assertEquals( "\u0000", Bytes.toString( equalInfoMap.get( Bytes.toBytes( "id" ) ) ) );
// 2nd entry
entry = buildOuSalesEntry();
@@ -393,28 +393,29 @@
@Test
public void testGetScanKey() throws Exception
{
- byte[] scanKey = objectClassIndexTable.getScanKey( "bar", HBaseIndexTable.DELIMITER, UUID
- .fromString( "00000000-0000-0000-0000-000000000000" ) );
- assertEquals( "=bar\u000000000000-0000-0000-0000-000000000000", Bytes.toString( scanKey ) );
-
- scanKey = objectClassIndexTable.getScanKey( "foo", HBaseIndexTable.DELIMITER, UUID
- .fromString( "ffffffff-ffff-ffff-ffff-ffffffffffff" ) );
- assertEquals( "=foo\u0000ffffffff-ffff-ffff-ffff-ffffffffffff", Bytes.toString( scanKey ) );
-
- scanKey = objectClassIndexTable.getScanKey( "foobar", HBaseIndexTable.DELIMITER, null );
- assertEquals( "=foobar\u0000", Bytes.toString( scanKey ) );
-
- scanKey = objectClassIndexTable.getScanKey( "", HBaseIndexTable.DELIMITER, UUID
- .fromString( "d3afbeaf-6a4f-448a-a542-2ef0bde880a5" ) );
- assertEquals( "=\u0000d3afbeaf-6a4f-448a-a542-2ef0bde880a5", Bytes.toString( scanKey ) );
+ byte[] scanKey = objectClassIndexTable.getScanKey( "bar", HBaseIndexTable.DELIMITER );
+ assertEquals( "=bar\u0000", Bytes.toString( scanKey ) );
- scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START, null, null );
+ scanKey = objectClassIndexTable.getScanKey( "foo", HBaseIndexTable.DELIMITER );
+ assertEquals( "=foo\u0000", Bytes.toString( scanKey ) );
+
+ scanKey = objectClassIndexTable.getScanKey( "foobar", null );
+ assertEquals( "=foobar", Bytes.toString( scanKey ) );
+
+ scanKey = objectClassIndexTable.getScanKey( "", HBaseIndexTable.DELIMITER );
+ assertEquals( "=\u0000", Bytes.toString( scanKey ) );
+
+ scanKey = objectClassIndexTable.getScanKey( "", null );
+ assertEquals( "=", Bytes.toString( scanKey ) );
+
+ scanKey = objectClassIndexTable.getScanKey( null, null );
assertTrue( Bytes.equals( new byte[]
- { '=', 0x00 }, scanKey ) );
+ { '=' }, scanKey ) );
- scanKey = objectClassIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP, null, null );
+ scanKey = objectClassIndexTable.getScanKey( null, null );
+ scanKey = Utils.incrementBytes( scanKey );
assertTrue( Bytes.equals( new byte[]
- { '=', ( byte ) 0xFF }, scanKey ) );
+ { '>', }, scanKey ) );
scanKey = cnIndexTable.getScanKey( "bar" );
assertEquals( "=bar", Bytes.toString( scanKey ) );
@@ -425,23 +426,26 @@
scanKey = cnIndexTable.getScanKey( "" );
assertEquals( "=", Bytes.toString( scanKey ) );
- scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_START );
+ scanKey = cnIndexTable.getScanKey( null );
assertTrue( Bytes.equals( new byte[]
- { '=', 0x00 }, scanKey ) );
+ { '=' }, scanKey ) );
- scanKey = cnIndexTable.getScanKey( HBaseIndexTable.FULL_SCAN_STOP );
+ scanKey = cnIndexTable.getScanKey( null );
+ scanKey = Utils.incrementBytes( scanKey );
assertTrue( Bytes.equals( new byte[]
- { '=', ( byte ) 0xFF }, scanKey ) );
+ { '>' }, scanKey ) );
}
@Test
public void testGetValue() throws Exception
{
- byte[] bytes = Bytes.toBytes( "=bar\u000000000000-0000-0000-0000-000000000000" );
+ byte[] bytes = Bytes.toBytes( "=bar\u000012345678-1234-1234-1234-123456789abc" );
assertEquals( 41, bytes.length );
Object value = objectClassIndexTable.extractValueFromEqualsKey( bytes );
assertEquals( "bar", value );
+ UUID uuid = objectClassIndexTable.extractEntryIdFromEqualsKey( bytes );
+ assertEquals( "12345678-1234-1234-1234-123456789abc", uuid.toString() );
bytes = new byte[]
{ '=', 0x00, 0x01, 0x00, '0', '0', '0', '0', '0', '0', '0', '0', '-', '0', '0', '0', '0', '-', '0', '0',
@@ -450,6 +454,8 @@
value = jpegPhotoIndexTable.extractValueFromEqualsKey( bytes );
assertTrue( Bytes.equals( new byte[]
{ 0x00, 0x01 }, ( byte[] ) value ) );
+ uuid = objectClassIndexTable.extractEntryIdFromEqualsKey( bytes );
+ assertEquals( "00000000-0000-0000-0000-000000000000", uuid.toString() );
value = cnIndexTable.extractValueFromEqualsKey( Bytes.toBytes( "=foobar" ) );
assertEquals( "foobar", value );