Skip to content

Commit

Permalink
Merge branch '3.9' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.9
  • Loading branch information
jumpmind-josh committed Aug 23, 2018
2 parents af9a129 + 04bed13 commit c42f0e0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
Expand Up @@ -247,6 +247,25 @@ public static File createSnapshot(ISymmetricEngine engine) {
"show processlist");
}

if (!engine.getParameterService().is(ParameterConstants.CLUSTER_LOCKING_ENABLED)) {
try {
List<DataGap> gaps = engine.getRouterService().getDataGaps();
SimpleDateFormat dformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
fos = new FileOutputStream(new File(tmpDir, "sym_data_gap_cache.csv"));
fos.write("start_id,end_id,create_time,last_update_time\n".getBytes());
if (gaps != null) {
for (DataGap gap : gaps) {
fos.write((gap.getStartId() + "," + gap.getEndId() + ",\"" + dformat.format(gap.getCreateTime()) + "\",\""
+ dformat.format(gap.getLastUpdateTime()) + "\"\n").getBytes());
}
}
} catch (IOException e) {
log.warn("Failed to export data gap information", e);
} finally {
IOUtils.closeQuietly(fos);
}
}

fwriter = null;
try {
fwriter = new FileWriter(new File(tmpDir, "threads.txt"));
Expand Down
Expand Up @@ -39,6 +39,7 @@
import bsh.Interpreter;
import bsh.ParseException;
import bsh.TargetError;
import bsh.Variable;

public class BshDatabaseWriterFilter extends DynamicDatabaseWriterFilter {

Expand Down Expand Up @@ -153,6 +154,8 @@ protected Interpreter getInterpreter(Context context) {

protected void bind(Interpreter interpreter, DataContext context, Table table, CsvData data, Exception error)
throws EvalError {

resetInterpreter(interpreter);

interpreter.set(LOG, log);
interpreter.set(ENGINE, this.engine);
Expand Down Expand Up @@ -188,6 +191,12 @@ protected void bind(Interpreter interpreter, DataContext context, Table table, C

}

protected void resetInterpreter(Interpreter interpreter) throws EvalError {
for (Variable variable : interpreter.getNameSpace().getDeclaredVariables()) {
interpreter.unset(variable.getName());
}
}

protected void processError(LoadFilter currentFilter, Table table, Throwable ex) {
if (ex instanceof TargetError) {
ex = ((TargetError) ex).getTarget();
Expand Down
Expand Up @@ -25,6 +25,7 @@
import java.util.Set;

import org.jumpmind.symmetric.model.Channel;
import org.jumpmind.symmetric.model.DataGap;
import org.jumpmind.symmetric.model.DataMetaData;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.NodeSecurity;
Expand Down Expand Up @@ -59,6 +60,8 @@ public boolean shouldDataBeRouted(SimpleRouterContext context, DataMetaData data

public Map<String, IDataRouter> getRouters();

public List<DataGap> getDataGaps();

public void stop ();

public Set<Channel> getCommomBatchChannels(List<Channel> channels, String nodeGroupId, List<TriggerRouter> triggerRouters);
Expand Down
Expand Up @@ -1205,6 +1205,10 @@ public Map<String, IDataRouter> getRouters() {
return extensionService.getExtensionPointMap(IDataRouter.class);
}

public List<DataGap> getDataGaps() {
return gapDetector.getDataGaps();
}

protected Table buildTableFromTriggerHistory(TriggerHistory triggerHistory) {
Table table = new Table(triggerHistory.getSourceCatalogName(), triggerHistory.getSourceSchemaName(), triggerHistory.getSourceTableName());
String[] columnNames = triggerHistory.getColumnNames().split(",");
Expand Down

0 comments on commit c42f0e0

Please sign in to comment.