forked from PlaytikaOSS/aerospike-janusgraph-storage-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed durable delete flag for wrtie policy
- Loading branch information
Showing
7 changed files
with
105 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
aerospike-container/src/main/java/com/aerospike/AsadmCommandExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.aerospike; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testcontainers.containers.Container; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
public class AsadmCommandExecutor { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(AsadmCommandExecutor.class); | ||
|
||
private final GenericContainer<?> aerospikeContainer; | ||
|
||
public AsadmCommandExecutor(GenericContainer<?> aerospikeContainer) { | ||
this.aerospikeContainer = aerospikeContainer; | ||
} | ||
|
||
public void execute(String command) { | ||
try { | ||
Container.ExecResult result = aerospikeContainer.execInContainer("asadm", "--enable", "-e", command); | ||
logStdout(result); | ||
if (result.getExitCode() != 0 || isBadResponse(result)) { | ||
throw new IllegalStateException(String.format("Failed to execute \"asadm --enable -e '%s'\": \nstdout:\n%s\nstderr:\n%s", | ||
command, result.getStdout(), result.getStderr())); | ||
} | ||
} catch (Exception ex) { | ||
throw new IllegalStateException(String.format("Failed to execute \"asadm\"", ex)); | ||
} | ||
} | ||
|
||
private boolean isBadResponse(Container.ExecResult execResult) { | ||
String stdout = execResult.getStdout(); | ||
/* | ||
Example of the stdout without error: | ||
~Set Namespace Param stop-writes-sys-memory-pct to 100~ | ||
Node|Response | ||
728bb242e58c:3000|ok | ||
Number of rows: 1 | ||
*/ | ||
return !stdout.contains("|ok"); | ||
} | ||
|
||
private static void logStdout(Container.ExecResult result) { | ||
log.debug("Aerospike asadm util stdout: \n{}\n{}", result.getStdout(), result.getStderr()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters