@@ -0,0 +1,2303 @@
+/*%0A * Licensed to Crate under one or more contributor license agreements.%0A * See the NOTICE file distributed with this work for additional%0A * information regarding copyright ownership.  Crate licenses this file%0A * to you under the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License.  You may%0A * obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or%0A * implied.  See the License for the specific language governing%0A * permissions and limitations under the License.%0A *%0A * However, if you have executed another commercial license agreement%0A * with Crate these terms will supersede the license and you may use the%0A * software solely pursuant to the terms of the relevant commercial%0A * agreement.%0A */%0A%0Apackage org.elasticsearch.index.translog;%0A%0Aimport io.crate.integrationtests.SQLTransportIntegrationTest;%0Aimport org.elasticsearch.test.ESIntegTestCase;%0A%0Aimport static org.hamcrest.Matchers.is;%0A%0A@ESIntegTestCase.ClusterScope(numDataNodes = 2)%0Apublic class TranslogHistoryTest extends SQLTransportIntegrationTest %7B%0A%0A    public void test_translog_is_trimmed_with_soft_deletes_enabled() throws Exception %7B%0A        execute(%22create table doc.test(x int) clustered into 1 shards with(number_of_replicas=1, %5C%22soft_deletes.enabled%5C%22='true')%22);%0A        ensureGreen();%0A%0A        int numDocs = randomIntBetween(1, 10);%0A        for(int i = 0; i %3C numDocs; i++) %7B%0A            execute(%22insert into doc.test(x) values(?)%22, new Object%5B%5D%7Bi%7D);%0A        %7D%0A        %0A        execute(%22refresh table doc.test%22);%0A        execute(%22optimize table doc.test%22);%0A%0A        ensureGreen();%0A%0A        assertBusy(() -%3E %7B%0A            execute(%22select translog_stats%5B'number_of_operations'%5D from sys.shards where table_name='test' and primary=true%22);%0A            assertThat(response.rows()%5B0%5D%5B0%5D, is(0));%0A        %7D);%0A        assertBusy(() -%3E %7B%0A            execute(%22select translog_stats%5B'number_of_operations'%5D from sys.shards where table_name='test' and primary=false%22);%0A            assertThat(response.rows()%5B0%5D%5B0%5D, is(0));%0A        %7D);%0A    %7D%0A%7D%0A

Add integration test to test if translog was trimmed correctly