Skip to content
Permalink
Browse files

SYMMETRICDS-528. If trying to update a Distribution Key column, compl…

…ete a delete and insert versus the update.
  • Loading branch information...
gwilmer committed Oct 25, 2011
1 parent c569ac4 commit a2841e9b19b7387e90e6e06b6f5c3089a825f12d
@@ -131,7 +131,12 @@ public int update(IDataLoaderContext ctx, String[] columnValues, String[] keyVal
for (int i = 0; i < columnValues.length; i++) {
Column column = allMetaData.get(columnNames[i].trim().toUpperCase());
if (column != null) {
if (doesColumnNeedUpdated(ctx, i, column, keyValues, columnValues)) {
if (doesColumnNeedUpdated(ctx, i, column, keyValues, columnValues)) {
// if one of the columns being updated is a partition key,
// return -1 and fallback to a delete / insert
if (column.isDistributionKey()) {
return -1;
}
changedColumnNameList.add(columnNames[i]);
changedColumnMetaList.add(column);
changedColumnValueList.add(columnValues[i]);
@@ -453,6 +453,9 @@ protected int update(String[] tokens) {
}
} else if (rows > 1) {
log.warn("LoaderRowsUpdatingFailed", rows, context.getTableName(), ArrayUtils.toString(tokens));
} else if (rows < 0) {
rows = context.getTableTemplate().delete(context, keyValues);
rows = context.getTableTemplate().insert(context, columnValues, keyValues);
}
stats.incrementDatabaseMillis(stats.endTimer());
}

0 comments on commit a2841e9

Please sign in to comment.
You can’t perform that action at this time.