75
75
import com .linkedin .venice .integration .utils .VeniceControllerWrapper ;
76
76
import com .linkedin .venice .integration .utils .VeniceMultiClusterWrapper ;
77
77
import com .linkedin .venice .integration .utils .VeniceRouterWrapper ;
78
+ import com .linkedin .venice .integration .utils .VeniceServerWrapper ;
78
79
import com .linkedin .venice .integration .utils .VeniceTwoLayerMultiRegionMultiClusterWrapper ;
79
80
import com .linkedin .venice .meta .DataReplicationPolicy ;
80
81
import com .linkedin .venice .meta .HybridStoreConfig ;
142
143
public class TestPushJobWithNativeReplication {
143
144
private static final Logger LOGGER = LogManager .getLogger (TestPushJobWithNativeReplication .class );
144
145
private static final int TEST_TIMEOUT = 2 * Time .MS_PER_MINUTE ;
145
-
146
146
private static final int NUMBER_OF_CHILD_DATACENTERS = 2 ;
147
147
private static final int NUMBER_OF_CLUSTERS = 1 ;
148
148
private static final String [] CLUSTER_NAMES =
@@ -161,6 +161,7 @@ public class TestPushJobWithNativeReplication {
161
161
162
162
private PubSubTopicRepository pubSubTopicRepository = new PubSubTopicRepository ();
163
163
private D2Client d2Client ;
164
+ private VeniceServerWrapper serverWrapper ;
164
165
165
166
@ DataProvider (name = "storeSize" )
166
167
public static Object [][] storeSize () {
@@ -179,7 +180,6 @@ public void setUp() {
179
180
serverProperties .setProperty (ROCKSDB_PLAIN_TABLE_FORMAT_ENABLED , "false" );
180
181
serverProperties .setProperty (SERVER_DATABASE_CHECKSUM_VERIFICATION_ENABLED , "true" );
181
182
serverProperties .setProperty (SERVER_DATABASE_SYNC_BYTES_INTERNAL_FOR_DEFERRED_WRITE_MODE , "300" );
182
-
183
183
Properties controllerProps = new Properties ();
184
184
// This property is required for test stores that have 10 partitions
185
185
controllerProps .put (DEFAULT_MAX_NUMBER_OF_PARTITIONS , 10 );
@@ -209,7 +209,7 @@ public void setUp() {
209
209
.setZkStartupTimeout (3 , TimeUnit .SECONDS )
210
210
.build ();
211
211
D2ClientUtils .startClient (d2Client );
212
-
212
+ serverWrapper = clusterWrapper . getVeniceServers (). get ( 0 );
213
213
}
214
214
215
215
@ AfterClass (alwaysRun = true )
@@ -957,19 +957,47 @@ public void testTargetedRegionPushJobFullConsumptionForBatchStore() throws Excep
957
957
}
958
958
});
959
959
}
960
+ String dataDBPathV1 = serverWrapper .getDataDirectory () + "/rocksdb/" + storeName + "_v1" ;
961
+ long storeSize = FileUtils .sizeOfDirectory (new File (dataDBPathV1 ));
962
+ try (VenicePushJob job = new VenicePushJob ("Test push job 2" , props )) {
963
+ job .run ();
964
+
965
+ TestUtils .waitForNonDeterministicAssertion (45 , TimeUnit .SECONDS , () -> {
966
+ for (int version : parentControllerClient .getStore (storeName )
967
+ .getStore ()
968
+ .getColoToCurrentVersions ()
969
+ .values ()) {
970
+ Assert .assertEquals (version , 2 );
971
+ }
972
+ });
973
+ }
960
974
props .put (TARGETED_REGION_PUSH_ENABLED , true );
961
- // props.put(POST_VALIDATION_CONSUMPTION_ENABLED, true);
962
975
TestWriteUtils .writeSimpleAvroFileWithStringToStringSchema (inputDir , 20 );
963
- try (VenicePushJob job = new VenicePushJob ("Test push job 2 " , props )) {
976
+ try (VenicePushJob job = new VenicePushJob ("Test push job 3 " , props )) {
964
977
job .run (); // the job should succeed
965
-
978
+ File directory = new File (serverWrapper .getDataDirectory () + "/rocksdb/" );
979
+ File [] storeDBDirs = directory .listFiles (File ::isDirectory );
980
+ long totalStoreSize = 0 ;
981
+ if (storeDBDirs != null ) {
982
+ for (File storeDB : storeDBDirs ) {
983
+ if (storeDB .getName ().startsWith (storeName )) {
984
+ long size = FileUtils
985
+ .sizeOfDirectory (new File (serverWrapper .getDataDirectory () + "/rocksdb/" + storeDB .getName ()));
986
+ ;
987
+ totalStoreSize += size ;
988
+ }
989
+ }
990
+ Assert .assertTrue (
991
+ storeSize * 2 >= totalStoreSize ,
992
+ "2x of store size " + storeSize + " is more than total " + totalStoreSize );
993
+ }
966
994
TestUtils .waitForNonDeterministicAssertion (45 , TimeUnit .SECONDS , () -> {
967
995
// Current version should become 2
968
996
for (int version : parentControllerClient .getStore (storeName )
969
997
.getStore ()
970
998
.getColoToCurrentVersions ()
971
999
.values ()) {
972
- Assert .assertEquals (version , 2 );
1000
+ Assert .assertEquals (version , 3 );
973
1001
}
974
1002
// should be able to read all 20 records.
975
1003
validateDaVinciClient (storeName , 20 );
0 commit comments