Skip to content

Commit

Permalink
feat: Update error message in TsurugidbWatcher and disabled default
Browse files Browse the repository at this point in the history
  • Loading branch information
hishidama committed Jun 6, 2024
1 parent 8aa171e commit 7902db4
Show file tree
Hide file tree
Showing 37 changed files with 62 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ tsurugi.endpoint=ipc:tsurugi
#tsurugi.endpoint=tcp://localhost:12345
tsurugi.user=cost-accounting
tsurugi.password=cost-accounting
tsurugi.watcher.enable=false


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dbms.type=tsurugi
tsurugi.endpoint=ipc:tsurugi
tsurugi.user=cbdb
tsurugi.password=cbdb
tsurugi.watcher.enable=true


## initial data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class BatchConfig {
private int threadSize;
private final int commitRatio;
private IsolationLevel isolationLevel;
private boolean enableTsurugidbWatcher = false;
private TgTxOption defaultTxOption;
private Map<Integer, TgTxOption> txOptionMap;
private BatchFactoryOrder batchFactoryOrder = BatchFactoryOrder.NONE;
Expand Down Expand Up @@ -118,6 +119,14 @@ public IsolationLevel getIsolationLevel() {
return this.isolationLevel;
}

public void setEnableTsurugidbWatcher(boolean enableTsurugidbWatcher) {
this.enableTsurugidbWatcher = enableTsurugidbWatcher;
}

public boolean enableTsurugidbWatcher() {
return this.enableTsurugidbWatcher;
}

public void setTxOptions(String txOptionProperty) {
String s = txOptionProperty.toUpperCase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public int executeCommand(String... args) throws Exception {
config.setDefaultTxOption(getOption(txOption));
config.setBatchFactoryOrder(BenchConst.getBatchCommandFactoryOrder());
config.setThreadSize(threadSize);
config.setEnableTsurugidbWatcher(BenchConst.tsurugiWatcherEnable());

OnlineConfig onlineConfig = null;
if (withOnline) {
Expand Down Expand Up @@ -145,7 +146,7 @@ private int execute1(int id, BatchConfig config, OnlineConfig onlineConfig, int

int exitCode;
TsurugidbWatcher watcher;
try (var watcherService = TsurugidbWatcherService.of()) {
try (var watcherService = TsurugidbWatcherService.of(config.enableTsurugidbWatcher())) {
watcher = watcherService.start();
exitCode = execute1Main(config, onlineConfig, attempt, records);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class OnlineConfig {
private IsolationLevel isolationLevel;
private boolean isMultiSession = true;
private int coverRate = 100;
private boolean enableTsurugidbWatcher = false;
private final Map<String, String> optionMap = new HashMap<>();
private final Map<String, Integer> threadSizeMap = new HashMap<>();
private int executeTime;
Expand Down Expand Up @@ -82,6 +83,14 @@ public String getCoverRateForReport(String taskName) {
return "-";
}

public void setEnableTsurugidbWatcher(boolean enableTsurugidbWatcher) {
this.enableTsurugidbWatcher = enableTsurugidbWatcher;
}

public boolean enableTsurugidbWatcher() {
return this.enableTsurugidbWatcher;
}

public void setTxOption(String taskName, String option) {
optionMap.put(taskName, option);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public int executeCommand(String... args) throws Exception {
config.setCoverRate(coverRate);
setTxOption(config, txOption);
config.setExecuteTime(executeTime);
config.setEnableTsurugidbWatcher(BenchConst.tsurugiWatcherEnable());

exitCode |= execute1(config, i, records);

Expand Down Expand Up @@ -121,7 +122,7 @@ private int execute1(OnlineConfig config, int attempt, List<OnlineResult> record

int exitCode;
TsurugidbWatcher watcher;
try (var watcherService = TsurugidbWatcherService.of()) {
try (var watcherService = TsurugidbWatcherService.of(config.enableTsurugidbWatcher())) {
watcher = watcherService.start();
exitCode = execute1Main(config, attempt, records);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public static String tsurugiPassword() {
return getProperty("tsurugi.password");
}

public static boolean tsurugiWatcherEnable() {
return getPropertyBoolean("tsurugi.watcher.enable", false);
}

public static String docDir() {
return getProperty("doc.dir");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public void run() {
}
}
} catch (IOException e) {
String msg = "Unable to retrieve memory info for tsurugidb. It is possible that the server has crashed.";
String msg = String.format( //
"Failed to access the process status file for tsurugidb at %s: " + //
"The server might be shut down. Check server status and logs.", //
path.toString()); //
LOG.error(msg, e);
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public class TsurugidbWatcherService implements AutoCloseable {
private ExecutorService service;
private Future<?> future;

public static TsurugidbWatcherService of() {
public static TsurugidbWatcherService of(boolean enableTsurugidbWatcher) {
TsurugidbWatcher task = null;
if (BenchConst.dbmsType() == DbmsType.TSURUGI) {
if (BenchConst.dbmsType() == DbmsType.TSURUGI && enableTsurugidbWatcher) {
int pid = findServerPid();
task = new TsurugidbWatcher(pid);
}
Expand Down

0 comments on commit 7902db4

Please sign in to comment.