@@ -155,6 +155,66 @@ public void testUpdateTablePropertiesNotifiesAllAliveBackendsInBatches() throws
155155 Assertions .assertEquals (Arrays .asList (103L ), syncRequests .get (3 ).getTabletIdsList ());
156156 }
157157
158+ @ Test
159+ public void testUpdateCompactionPolicyExcludesRowBinlogTablets () throws Exception {
160+ CloudSchemaChangeHandler handler = new CloudSchemaChangeHandler ();
161+ Database db = createMockDatabaseWithRowBinlogTablet ();
162+ Env env = Mockito .mock (Env .class );
163+ MetaServiceProxy metaServiceProxy = Mockito .mock (MetaServiceProxy .class );
164+ Mockito .when (metaServiceProxy .updateTablet (Mockito .any ())).thenReturn (okUpdateTabletResponse ());
165+
166+ Config .enable_debug_points = true ;
167+ DebugPointUtil .addDebugPoint ("CloudSchemaChangeHandler.notifyBackendsToSyncTabletMeta.skip" );
168+ try (MockedStatic <Env > envMock = Mockito .mockStatic (Env .class );
169+ MockedStatic <MetaServiceProxy > metaProxyMock = Mockito .mockStatic (MetaServiceProxy .class )) {
170+ envMock .when (Env ::getCurrentEnv ).thenReturn (env );
171+ metaProxyMock .when (MetaServiceProxy ::getInstance ).thenReturn (metaServiceProxy );
172+
173+ Map <String , String > properties = new HashMap <>();
174+ properties .put (PropertyAnalyzer .PROPERTIES_COMPACTION_POLICY ,
175+ PropertyAnalyzer .TIME_SERIES_COMPACTION_POLICY );
176+ handler .updateTableProperties (db , "tbl" , properties );
177+ }
178+
179+ ArgumentCaptor <Cloud .UpdateTabletRequest > updateCaptor =
180+ ArgumentCaptor .forClass (Cloud .UpdateTabletRequest .class );
181+ Mockito .verify (metaServiceProxy ).updateTablet (updateCaptor .capture ());
182+ List <Cloud .TabletMetaInfoPB > tabletMetaInfos = updateCaptor .getValue ().getTabletMetaInfosList ();
183+ Assertions .assertEquals (Arrays .asList (101L ), tabletMetaInfos .stream ()
184+ .map (Cloud .TabletMetaInfoPB ::getTabletId ).collect (Collectors .toList ()));
185+ Assertions .assertTrue (tabletMetaInfos .stream ().allMatch (info ->
186+ PropertyAnalyzer .TIME_SERIES_COMPACTION_POLICY .equals (info .getCompactionPolicy ())));
187+ }
188+
189+ @ Test
190+ public void testUpdateTtlIncludesRowBinlogTablets () throws Exception {
191+ CloudSchemaChangeHandler handler = new CloudSchemaChangeHandler ();
192+ Database db = createMockDatabaseWithRowBinlogTablet ();
193+ Env env = Mockito .mock (Env .class );
194+ MetaServiceProxy metaServiceProxy = Mockito .mock (MetaServiceProxy .class );
195+ Mockito .when (metaServiceProxy .updateTablet (Mockito .any ())).thenReturn (okUpdateTabletResponse ());
196+
197+ Config .enable_debug_points = true ;
198+ DebugPointUtil .addDebugPoint ("CloudSchemaChangeHandler.notifyBackendsToSyncTabletMeta.skip" );
199+ try (MockedStatic <Env > envMock = Mockito .mockStatic (Env .class );
200+ MockedStatic <MetaServiceProxy > metaProxyMock = Mockito .mockStatic (MetaServiceProxy .class )) {
201+ envMock .when (Env ::getCurrentEnv ).thenReturn (env );
202+ metaProxyMock .when (MetaServiceProxy ::getInstance ).thenReturn (metaServiceProxy );
203+
204+ Map <String , String > properties = new HashMap <>();
205+ properties .put (PropertyAnalyzer .PROPERTIES_FILE_CACHE_TTL_SECONDS , "300" );
206+ handler .updateTableProperties (db , "tbl" , properties );
207+ }
208+
209+ ArgumentCaptor <Cloud .UpdateTabletRequest > updateCaptor =
210+ ArgumentCaptor .forClass (Cloud .UpdateTabletRequest .class );
211+ Mockito .verify (metaServiceProxy ).updateTablet (updateCaptor .capture ());
212+ List <Cloud .TabletMetaInfoPB > tabletMetaInfos = updateCaptor .getValue ().getTabletMetaInfosList ();
213+ Assertions .assertEquals (Arrays .asList (101L , 201L ), tabletMetaInfos .stream ()
214+ .map (Cloud .TabletMetaInfoPB ::getTabletId ).collect (Collectors .toList ()));
215+ Assertions .assertTrue (tabletMetaInfos .stream ().allMatch (info -> info .getTtlSeconds () == 300 ));
216+ }
217+
158218 @ Test
159219 public void testUpdateTablePropertiesThrowsWhenUpdateTabletFails () throws Exception {
160220 CloudSchemaChangeHandler handler = new CloudSchemaChangeHandler ();
@@ -552,13 +612,42 @@ private Database createMockDatabaseWithThreeTablets() throws Exception {
552612 Mockito .when (partition .getName ()).thenReturn ("p1" );
553613 Mockito .when (partition .getMaterializedIndices (MaterializedIndex .IndexExtState .VISIBLE , true ))
554614 .thenReturn (Arrays .asList (index ));
615+ Mockito .when (partition .getMaterializedIndices (MaterializedIndex .IndexExtState .VISIBLE , false ))
616+ .thenReturn (Arrays .asList (index ));
555617 Mockito .when (index .getTablets ()).thenReturn (Arrays .asList (tablet1 , tablet2 , tablet3 ));
556618 Mockito .when (tablet1 .getId ()).thenReturn (101L );
557619 Mockito .when (tablet2 .getId ()).thenReturn (102L );
558620 Mockito .when (tablet3 .getId ()).thenReturn (103L );
559621 return db ;
560622 }
561623
624+ private Database createMockDatabaseWithRowBinlogTablet () throws Exception {
625+ Database db = Mockito .mock (Database .class );
626+ OlapTable table = Mockito .mock (OlapTable .class );
627+ Partition partition = Mockito .mock (Partition .class );
628+ MaterializedIndex baseIndex = Mockito .mock (MaterializedIndex .class );
629+ MaterializedIndex rowBinlogIndex = Mockito .mock (MaterializedIndex .class );
630+ org .apache .doris .catalog .Tablet baseTablet = Mockito .mock (org .apache .doris .catalog .Tablet .class );
631+ org .apache .doris .catalog .Tablet rowBinlogTablet = Mockito .mock (org .apache .doris .catalog .Tablet .class );
632+
633+ Mockito .when (db .getTableOrMetaException ("tbl" , Table .TableType .OLAP )).thenReturn (table );
634+ Mockito .when (table .getName ()).thenReturn ("tbl" );
635+ Mockito .when (table .getCompactionPolicy ()).thenReturn (PropertyAnalyzer .SIZE_BASED_COMPACTION_POLICY );
636+ Mockito .when (table .getKeysType ()).thenReturn (KeysType .DUP_KEYS );
637+ Mockito .when (table .getPartitions ()).thenReturn (Arrays .asList (partition ));
638+ Mockito .when (table .getPartition ("p1" )).thenReturn (partition );
639+ Mockito .when (partition .getName ()).thenReturn ("p1" );
640+ Mockito .when (partition .getMaterializedIndices (MaterializedIndex .IndexExtState .VISIBLE , true ))
641+ .thenReturn (Arrays .asList (baseIndex , rowBinlogIndex ));
642+ Mockito .when (partition .getMaterializedIndices (MaterializedIndex .IndexExtState .VISIBLE , false ))
643+ .thenReturn (Arrays .asList (baseIndex ));
644+ Mockito .when (baseIndex .getTablets ()).thenReturn (Arrays .asList (baseTablet ));
645+ Mockito .when (rowBinlogIndex .getTablets ()).thenReturn (Arrays .asList (rowBinlogTablet ));
646+ Mockito .when (baseTablet .getId ()).thenReturn (101L );
647+ Mockito .when (rowBinlogTablet .getId ()).thenReturn (201L );
648+ return db ;
649+ }
650+
562651 private InternalService .PSyncTabletMetaResponse okSyncTabletMetaResponse () {
563652 return InternalService .PSyncTabletMetaResponse .newBuilder ()
564653 .setStatus (org .apache .doris .proto .Types .PStatus .newBuilder ()
0 commit comments