siddharthteotia commented on code in PR #9454:
URL: https://github.com/apache/pinot/pull/9454#discussion_r983122859


##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/SegmentPreProcessorTest.java:
##########
@@ -304,6 +306,28 @@ public void testEnableFSTIndexOnExistingColumnDictEncoded()
     checkFSTIndexCreation(EXISTING_STRING_COL_DICT, 9, 4, 
_newColumnsSchemaWithFST, false, false, 26);
   }
 
+  @Test
+  public void testForwardIndexHandler()
+      throws Exception {
+    Map<String, ChunkCompressionType> compressionConfigs = new HashMap<>();
+    ChunkCompressionType newCompressionType = ChunkCompressionType.ZSTANDARD;
+    compressionConfigs.put(EXISTING_STRING_COL_RAW, newCompressionType);
+    _indexLoadingConfig.setCompressionConfigs(compressionConfigs);
+    _indexLoadingConfig.setNoDictionaryColumns(new HashSet<String>() {{
+      add(EXISTING_STRING_COL_RAW);
+    }});
+
+    // Test1: Rewriting forward index will be a no-op for v1 segments. Default 
LZ4 compressionType will be retained.
+    constructV1Segment();
+    checkForwardIndexCreation(EXISTING_STRING_COL_RAW, 5, 3, _schema, false, 
false, false, 0, ChunkCompressionType.LZ4);
+
+    // Convert the segment to V3.
+    new SegmentV1V2ToV3FormatConverter().convert(_indexDir);
+
+    // Test2: Now forward index will be rewritten with ZSTANDARD 
compressionType.

Review Comment:
   So one concern (and please clarify if this is a non-issue) I had was for the 
scenario I asked for in first point
   
   Once the ForwardIndexHandler finishes rewriting fwd index with new comp 
codec and we return
   - the new fwd index is in v3 format
   - the entry for old fwd index is removed from in-memory map
   - the index_map file has 2 entries for fwd index on that column (old and new)
   
   Next handler (RangeIndexHandler in this case) gets invoked and reads the 
forward index to generate range index. I am guessing this will read the new 
forward index (because old one is no longer accessible via the _columnEntries 
map). 
   
   Basically, my concern was if the range index gets generated incorrectly / 
corrupt because of 2 forward indexes (since sweep hasn't been done as of this 
time). But looks like this can't happen



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to