Skip to content

Commit

Permalink
0003667: Bulk loads should not log errors while falling back to default
Browse files Browse the repository at this point in the history
loader
  • Loading branch information
jumpmind-josh committed Aug 9, 2018
1 parent 812f7f4 commit 5c3cdc1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
@@ -1,8 +1,8 @@
package org.jumpmind.symmetric.io;

import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.symmetric.common.ContextConstants;
import org.jumpmind.symmetric.io.data.CsvData;
import org.jumpmind.symmetric.io.data.IDataWriter;
import org.jumpmind.symmetric.io.data.writer.DatabaseWriterSettings;
import org.jumpmind.symmetric.io.data.writer.DynamicDefaultDatabaseWriter;

Expand All @@ -18,10 +18,10 @@ public AbstractBulkDatabaseWriter(IDatabasePlatform symmetricPlatform, IDatabase
}

public final void write(CsvData data) {
if (context.get(IDataWriter.CONTEXT_BULK_WRITER_TO_USE) != null && context.get(IDataWriter.CONTEXT_BULK_WRITER_TO_USE).equals("default")) {
if (context.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE) != null && context.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE).equals("default")) {
writeDefault(data);
}else{
context.put(IDataWriter.CONTEXT_BULK_WRITER_TO_USE, "bulk");
context.put(ContextConstants.CONTEXT_BULK_WRITER_TO_USE, "bulk");
bulkWrite(data);
}
}
Expand Down
Expand Up @@ -13,4 +13,7 @@ private ContextConstants() {

public static final String FILE_SYNC_FAST_SCAN_TRACK_TIME = "file.sync.fast.scan.track.time";

public static final String CONTEXT_BULK_WRITER_TO_USE = "bulkWriterToUse";


}
Expand Up @@ -63,6 +63,7 @@
import org.jumpmind.symmetric.SymmetricException;
import org.jumpmind.symmetric.Version;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ContextConstants;
import org.jumpmind.symmetric.common.ErrorConstants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.ext.INodeRegistrationListener;
Expand Down Expand Up @@ -1038,8 +1039,8 @@ protected IDataWriter chooseDataWriter(Batch batch) {
loadInfo.setStatus(ProcessStatus.OK);
}
} catch (Exception e) {
if (ctx.get(IDataWriter.CONTEXT_BULK_FALLBACK_TO_DEFAULT) != null && ctx.get(IDataWriter.CONTEXT_BULK_FALLBACK_TO_DEFAULT).equals("bulk")) {
ctx.put(IDataWriter.CONTEXT_BULK_FALLBACK_TO_DEFAULT, "default");
if (ctx.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE) != null && ctx.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE).equals("bulk")) {
ctx.put(ContextConstants.CONTEXT_BULK_WRITER_TO_USE, "default");
processor.setDataReader(buildDataReader(batchInStaging, resource));
processor.process(ctx);
} else {
Expand Down
Expand Up @@ -34,14 +34,13 @@
import org.jumpmind.exception.IoException;
import org.jumpmind.symmetric.ISymmetricEngine;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.common.ContextConstants;
import org.jumpmind.symmetric.common.ErrorConstants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.io.data.Batch;
import org.jumpmind.symmetric.io.data.DataContext;
import org.jumpmind.symmetric.io.data.DataProcessor;
import org.jumpmind.symmetric.io.data.IDataProcessorListener;
import org.jumpmind.symmetric.io.data.IDataWriter;
import org.jumpmind.symmetric.io.data.writer.Conflict;
import org.jumpmind.symmetric.io.data.writer.ConflictException;
import org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter;
Expand Down Expand Up @@ -192,7 +191,7 @@ public void batchInError(DataContext context, Throwable ex) {
throw ex;
}

if (context.get(IDataWriter.CONTEXT_BULK_WRITER_TO_USE) != null && context.get(IDataWriter.CONTEXT_BULK_WRITER_TO_USE).equals("bulk")) {
if (context.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE) != null && context.get(ContextConstants.CONTEXT_BULK_WRITER_TO_USE).equals("bulk")) {
log.info("Bulk loading failed for this batch " + context.getBatch().getBatchId() + ", falling back to default loading.");
log.debug("Bulk loading error.", ex);
} else {
Expand Down
Expand Up @@ -25,8 +25,6 @@

public interface IDataWriter extends IDataResource {

public static final String CONTEXT_BULK_WRITER_TO_USE = "bulkWriterToUse";

public void start(Batch batch);

public boolean start(Table table);
Expand Down

0 comments on commit 5c3cdc1

Please sign in to comment.