Search in sources :

Example 1 with VisorWalTaskResult

use of org.apache.ignite.internal.visor.misc.VisorWalTaskResult in project ignite by apache.

the class WalCommands method deleteUnusedWalSegments.

/**
 * Execute delete unused WAL segments task.
 *  @param client Client.
 * @param walArgs WAL args.
 * @param clientCfg Client configuration.
 */
private void deleteUnusedWalSegments(GridClient client, String walArgs, GridClientConfiguration clientCfg) throws Exception {
    VisorWalTaskResult res = executeTask(client, VisorWalTask.class, walArg(VisorWalTaskOperation.DELETE_UNUSED_WAL_SEGMENTS, walArgs), clientCfg);
    printDeleteWalSegments0(res);
}
Also used : VisorWalTaskResult(org.apache.ignite.internal.visor.misc.VisorWalTaskResult)

Example 2 with VisorWalTaskResult

use of org.apache.ignite.internal.visor.misc.VisorWalTaskResult in project ignite by apache.

the class WalCommands method printUnusedWalSegments.

/**
 * Execute print unused WAL segments task.
 *  @param client Client.
 * @param walArgs Wal args.
 * @param clientCfg Client configuration.
 */
private void printUnusedWalSegments(GridClient client, String walArgs, GridClientConfiguration clientCfg) throws Exception {
    VisorWalTaskResult res = executeTask(client, VisorWalTask.class, walArg(VisorWalTaskOperation.PRINT_UNUSED_WAL_SEGMENTS, walArgs), clientCfg);
    printUnusedWalSegments0(res);
}
Also used : VisorWalTaskResult(org.apache.ignite.internal.visor.misc.VisorWalTaskResult)

Example 3 with VisorWalTaskResult

use of org.apache.ignite.internal.visor.misc.VisorWalTaskResult in project ignite by apache.

the class GridInternalTaskUnusedWalSegmentsTest method testCorrectnessOfDeletionTaskSegments.

/**
 * Tests correctness of {@link VisorWalTaskOperation}.
 *
 * @throws Exception if failed.
 */
@Test
@WithSystemProperty(key = IGNITE_PDS_MAX_CHECKPOINT_MEMORY_HISTORY_SIZE, value = "2")
public void testCorrectnessOfDeletionTaskSegments() throws Exception {
    try {
        IgniteEx ig0 = (IgniteEx) startGrids(4);
        ig0.cluster().active(true);
        try (IgniteDataStreamer streamer = ig0.dataStreamer(DEFAULT_CACHE_NAME)) {
            for (int k = 0; k < 10_000; k++) streamer.addData(k, new byte[1024]);
        }
        forceCheckpoint();
        try (IgniteDataStreamer streamer = ig0.dataStreamer(DEFAULT_CACHE_NAME)) {
            for (int k = 0; k < 1_000; k++) streamer.addData(k, new byte[1024]);
        }
        forceCheckpoint();
        VisorWalTaskResult printRes = ig0.compute().execute(VisorWalTask.class, new VisorTaskArgument<>(ig0.cluster().node().id(), new VisorWalTaskArg(VisorWalTaskOperation.PRINT_UNUSED_WAL_SEGMENTS), false));
        assertEquals("Check that print task finished without exceptions", printRes.results().size(), 4);
        List<File> walArchives = new ArrayList<>();
        for (Collection<String> pathsPerNode : printRes.results().values()) {
            for (String path : pathsPerNode) walArchives.add(Paths.get(path).toFile());
        }
        VisorWalTaskResult delRes = ig0.compute().execute(VisorWalTask.class, new VisorTaskArgument<>(ig0.cluster().node().id(), new VisorWalTaskArg(VisorWalTaskOperation.DELETE_UNUSED_WAL_SEGMENTS), false));
        assertEquals("Check that delete task finished with no exceptions", delRes.results().size(), 4);
        List<File> walDeletedArchives = new ArrayList<>();
        for (Collection<String> pathsPerNode : delRes.results().values()) {
            for (String path : pathsPerNode) walDeletedArchives.add(Paths.get(path).toFile());
        }
        for (File f : walDeletedArchives) assertTrue("Checking existing of deleted WAL archived segments: " + f.getAbsolutePath(), !f.exists());
        for (File f : walArchives) assertTrue("Checking existing of WAL archived segments from print task after delete: " + f.getAbsolutePath(), !f.exists());
    } finally {
        stopAllGrids();
    }
}
Also used : VisorWalTaskArg(org.apache.ignite.internal.visor.misc.VisorWalTaskArg) IgniteDataStreamer(org.apache.ignite.IgniteDataStreamer) IgniteEx(org.apache.ignite.internal.IgniteEx) VisorWalTaskResult(org.apache.ignite.internal.visor.misc.VisorWalTaskResult) ArrayList(java.util.ArrayList) File(java.io.File) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Aggregations

VisorWalTaskResult (org.apache.ignite.internal.visor.misc.VisorWalTaskResult)3 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IgniteDataStreamer (org.apache.ignite.IgniteDataStreamer)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 VisorWalTaskArg (org.apache.ignite.internal.visor.misc.VisorWalTaskArg)1 WithSystemProperty (org.apache.ignite.testframework.junits.WithSystemProperty)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1