File tree Expand file tree Collapse file tree
hudi-flink-datasource/hudi-flink/src
main/java/org/apache/hudi/sink
test/java/org/apache/hudi/sink/meta Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ private static void initMetadataTable(HoodieFlinkWriteClient<?> writeClient) {
341341
342342 private static CkpMetadata initCkpMetadata (HoodieTableMetaClient metaClient ) throws IOException {
343343 CkpMetadata ckpMetadata = CkpMetadata .getInstance (metaClient .getFs (), metaClient .getBasePath ());
344- ckpMetadata .bootstrap (metaClient );
344+ ckpMetadata .bootstrap ();
345345 return ckpMetadata ;
346346 }
347347
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ public void close() {
9494 *
9595 * <p>This expects to be called by the driver.
9696 */
97- public void bootstrap (HoodieTableMetaClient metaClient ) throws IOException {
97+ public void bootstrap () throws IOException {
9898 fs .delete (path , true );
9999 fs .mkdirs (path );
100100 }
@@ -173,8 +173,8 @@ private void load() {
173173 @ Nullable
174174 public String lastPendingInstant () {
175175 load ();
176- for ( int i = this .messages .size () - 1 ; i >= 0 ; i -- ) {
177- CkpMessage ckpMsg = this .messages .get (i );
176+ if ( this .messages .size () > 0 ) {
177+ CkpMessage ckpMsg = this .messages .get (this . messages . size () - 1 );
178178 // consider 'aborted' as pending too to reuse the instant
179179 if (!ckpMsg .isComplete ()) {
180180 return ckpMsg .getInstant ();
Original file line number Diff line number Diff line change 3232import java .io .File ;
3333import java .util .stream .IntStream ;
3434
35+ import static org .hamcrest .CoreMatchers .equalTo ;
3536import static org .hamcrest .CoreMatchers .is ;
3637import static org .hamcrest .MatcherAssert .assertThat ;
3738
@@ -63,7 +64,7 @@ void testWriteAndReadMessage() {
6364
6465 assertThat (metadata .lastPendingInstant (), is ("2" ));
6566 metadata .commitInstant ("2" );
66- assertThat (metadata .lastPendingInstant (), is ( "1" ));
67+ assertThat (metadata .lastPendingInstant (), equalTo ( null ));
6768
6869 // test cleaning
6970 IntStream .range (3 , 6 ).forEach (i -> metadata .startInstant (i + "" ));
You can’t perform that action at this time.
0 commit comments