This is an automated email from the ASF dual-hosted git repository.
ankitsultana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new d8ca448779 [Hotfix] init correct upsert manager with
_enableDeletedKeysCompactionConsistency config (#13896)
d8ca448779 is described below
commit d8ca448779cc3e623f6c45cea0fcd838393f41d9
Author: Pratik Tibrewal <[email protected]>
AuthorDate: Wed Aug 28 00:55:25 2024 +0530
[Hotfix] init correct upsert manager with
_enableDeletedKeysCompactionConsistency config (#13896)
---
.../ConcurrentMapTableUpsertMetadataManager.java | 4 ++--
.../TableUpsertMetadataManagerFactoryTest.java | 27 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapTableUpsertMetadataManager.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapTableUpsertMetadataManager.java
index 7280b86833..882715d787 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapTableUpsertMetadataManager.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapTableUpsertMetadataManager.java
@@ -49,8 +49,8 @@ public class ConcurrentMapTableUpsertMetadataManager extends
BaseTableUpsertMeta
public BasePartitionUpsertMetadataManager getOrCreatePartitionManager(int
partitionId) {
return _partitionMetadataManagerMap.computeIfAbsent(partitionId,
k -> _enableDeletedKeysCompactionConsistency
- ? new
ConcurrentMapPartitionUpsertMetadataManager(_tableNameWithType, k, _context)
- : new
ConcurrentMapPartitionUpsertMetadataManagerForConsistentDeletes(_tableNameWithType,
k, _context));
+ ? new
ConcurrentMapPartitionUpsertMetadataManagerForConsistentDeletes(_tableNameWithType,
k, _context)
+ : new
ConcurrentMapPartitionUpsertMetadataManager(_tableNameWithType, k, _context));
}
@Override
diff --git
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/upsert/TableUpsertMetadataManagerFactoryTest.java
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/upsert/TableUpsertMetadataManagerFactoryTest.java
index daf10826c9..08f9796ff6 100644
---
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/upsert/TableUpsertMetadataManagerFactoryTest.java
+++
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/upsert/TableUpsertMetadataManagerFactoryTest.java
@@ -18,13 +18,20 @@
*/
package org.apache.pinot.segment.local.upsert;
+import com.google.common.collect.Lists;
+import java.io.File;
+import org.apache.pinot.segment.local.data.manager.TableDataManager;
import org.apache.pinot.spi.config.table.HashFunction;
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.config.table.TableType;
import org.apache.pinot.spi.config.table.UpsertConfig;
+import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.data.Schema;
import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
import org.testng.annotations.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
@@ -37,12 +44,21 @@ public class TableUpsertMetadataManagerFactoryTest {
public void testCreateForDefaultManagerClass() {
UpsertConfig upsertConfig = new UpsertConfig(UpsertConfig.Mode.FULL);
upsertConfig.setHashFunction(HashFunction.NONE);
+ Schema schema =
+ new Schema.SchemaBuilder().setSchemaName(RAW_TABLE_NAME)
+ .addSingleValueDimension("myCol", FieldSpec.DataType.STRING)
+ .setPrimaryKeyColumns(Lists.newArrayList("myCol")).build();
+ TableDataManager tableDataManager = mock(TableDataManager.class);
+ when(tableDataManager.getTableDataDir()).thenReturn(new
File(RAW_TABLE_NAME));
_tableConfig =
new
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setUpsertConfig(upsertConfig).build();
TableUpsertMetadataManager tableUpsertMetadataManager =
TableUpsertMetadataManagerFactory.create(_tableConfig, null);
assertNotNull(tableUpsertMetadataManager);
assertTrue(tableUpsertMetadataManager instanceof
ConcurrentMapTableUpsertMetadataManager);
+ tableUpsertMetadataManager.init(_tableConfig, schema, tableDataManager);
+ assertTrue(tableUpsertMetadataManager.getOrCreatePartitionManager(0)
+ instanceof ConcurrentMapPartitionUpsertMetadataManager);
}
@Test
@@ -50,11 +66,20 @@ public class TableUpsertMetadataManagerFactoryTest {
UpsertConfig upsertConfig = new UpsertConfig(UpsertConfig.Mode.FULL);
upsertConfig.setHashFunction(HashFunction.NONE);
upsertConfig.setEnableDeletedKeysCompactionConsistency(true);
+ Schema schema =
+ new Schema.SchemaBuilder().setSchemaName(RAW_TABLE_NAME)
+ .addSingleValueDimension("myCol", FieldSpec.DataType.STRING)
+ .setPrimaryKeyColumns(Lists.newArrayList("myCol")).build();
+ TableDataManager tableDataManager = mock(TableDataManager.class);
+ when(tableDataManager.getTableDataDir()).thenReturn(new
File(RAW_TABLE_NAME));
_tableConfig =
new
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setUpsertConfig(upsertConfig).build();
TableUpsertMetadataManager tableUpsertMetadataManager =
TableUpsertMetadataManagerFactory.create(_tableConfig, null);
assertNotNull(tableUpsertMetadataManager);
- assertTrue(tableUpsertMetadataManager instanceof
BaseTableUpsertMetadataManager);
+ assertTrue(tableUpsertMetadataManager instanceof
ConcurrentMapTableUpsertMetadataManager);
+ tableUpsertMetadataManager.init(_tableConfig, schema, tableDataManager);
+ assertTrue(tableUpsertMetadataManager.getOrCreatePartitionManager(0)
+ instanceof
ConcurrentMapPartitionUpsertMetadataManagerForConsistentDeletes);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]