@@ -125,32 +125,46 @@ public void testReverseScanWithDBE() throws IOException {
125125
126126    try  (Connection  connection  = ConnectionFactory .createConnection (conf )) {
127127      for  (DataBlockEncoding  encoding  : DataBlockEncoding .values ()) {
128-         testReverseScanWithDBE (connection , encoding , family );
128+         testReverseScanWithDBE (connection , encoding , family ,  HConstants . DEFAULT_BLOCKSIZE ,  10 );
129129      }
130130    }
131131  }
132132
133-   private  void  testReverseScanWithDBE (Connection  conn , DataBlockEncoding  encoding , byte [] family )
134-     throws  IOException  {
133+   /** 
134+    * Test that we can do reverse scans when writing tags and using DataBlockEncoding. Fails with an 
135+    * exception for PREFIX, DIFF, and FAST_DIFF 
136+    */ 
137+   @ Test 
138+   public  void  testReverseScanWithDBEWhenCurrentBlockUpdates () throws  IOException  {
139+     byte [] family  = Bytes .toBytes ("0" );
140+ 
141+     Configuration  conf  = new  Configuration (TEST_UTIL .getConfiguration ());
142+     conf .setInt (HConstants .HBASE_CLIENT_RETRIES_NUMBER , 1 );
143+ 
144+     try  (Connection  connection  = ConnectionFactory .createConnection (conf )) {
145+       for  (DataBlockEncoding  encoding  : DataBlockEncoding .values ()) {
146+         testReverseScanWithDBE (connection , encoding , family , 1024 , 30000 );
147+       }
148+     }
149+   }
150+ 
151+   private  void  testReverseScanWithDBE (Connection  conn , DataBlockEncoding  encoding , byte [] family ,
152+     int  blockSize , int  maxRows ) throws  IOException  {
135153    LOG .info ("Running test with DBE={}" , encoding );
136154    TableName  tableName  = TableName .valueOf (TEST_NAME .getMethodName () + "-"  + encoding );
137-     TEST_UTIL .createTable (TableDescriptorBuilder . newBuilder ( tableName ) 
138-       . setColumnFamily (
139-         ColumnFamilyDescriptorBuilder .newBuilder (family ).setDataBlockEncoding (encoding ).build ())
140-       . build (),  null );
155+     TEST_UTIL .createTable (
156+       TableDescriptorBuilder . newBuilder ( tableName ). setColumnFamily (ColumnFamilyDescriptorBuilder 
157+         .newBuilder (family ).setDataBlockEncoding (encoding ).setBlocksize ( blockSize ). build ()). build (), 
158+       null );
141159
142160    Table  table  = conn .getTable (tableName );
143161
144-     int  maxRows  = 10 ;
145162    byte [] val1  = new  byte [10 ];
146163    byte [] val2  = new  byte [10 ];
147164    Bytes .random (val1 );
148165    Bytes .random (val2 );
149166
150167    for  (int  i  = 0 ; i  < maxRows ; i ++) {
151-       if  (i  == maxRows  / 2 ) {
152-         TEST_UTIL .flush (tableName );
153-       }
154168      table .put (new  Put (Bytes .toBytes (i )).addColumn (family , Bytes .toBytes (1 ), val1 )
155169        .addColumn (family , Bytes .toBytes (2 ), val2 ).setTTL (600_000 ));
156170    }
0 commit comments