embulk-output-jdbc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bd1b7647602182c1366959df589ccd8125ee6b6
|
4
|
+
data.tar.gz: 33c939b19118bc91c54928cf2977926ec283fb9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7883449a40ea159edbee72967318ed54424cc4a9b5911b9dd913e1da72d41bfadebd4be0f5b2758ed71cb61bbf41721df9bdeac583bb8a3e69e53be01396731
|
7
|
+
data.tar.gz: 5556fef4b4a6d2d7caf145daa833758fbafdbe3c4f1fb494e1b99e0b34d181719a0cf3e7d778297a74677be2c3f86817785b69fe08bb19aee64ed170dcbd2788
|
Binary file
|
@@ -141,7 +141,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
141
141
|
}
|
142
142
|
|
143
143
|
public ConfigDiff transaction(ConfigSource config,
|
144
|
-
Schema schema, int
|
144
|
+
Schema schema, int taskCount,
|
145
145
|
OutputPlugin.Control control)
|
146
146
|
{
|
147
147
|
PluginTask task = config.loadConfig(getTaskClass());
|
@@ -181,13 +181,13 @@ public abstract class AbstractJdbcOutputPlugin
|
|
181
181
|
// new ConfigException(String.format("Unknown mode '%s'. Supported modes are: insert_direct, replace_inplace", task.getModeConfig()));
|
182
182
|
//}
|
183
183
|
|
184
|
-
task = begin(task, schema,
|
184
|
+
task = begin(task, schema, taskCount);
|
185
185
|
control.run(task.dump());
|
186
|
-
return commit(task, schema,
|
186
|
+
return commit(task, schema, taskCount);
|
187
187
|
}
|
188
188
|
|
189
189
|
public ConfigDiff resume(TaskSource taskSource,
|
190
|
-
Schema schema, int
|
190
|
+
Schema schema, int taskCount,
|
191
191
|
OutputPlugin.Control control)
|
192
192
|
{
|
193
193
|
PluginTask task = taskSource.loadTask(getTaskClass());
|
@@ -196,9 +196,9 @@ public abstract class AbstractJdbcOutputPlugin
|
|
196
196
|
throw new UnsupportedOperationException("inplace mode is not resumable. You need to delete partially-loaded records from the database and restart the entire transaction.");
|
197
197
|
}
|
198
198
|
|
199
|
-
task = begin(task, schema,
|
199
|
+
task = begin(task, schema, taskCount);
|
200
200
|
control.run(task.dump());
|
201
|
-
return commit(task, schema,
|
201
|
+
return commit(task, schema, taskCount);
|
202
202
|
}
|
203
203
|
|
204
204
|
private String getTransactionUniqueName()
|
@@ -209,7 +209,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
209
209
|
}
|
210
210
|
|
211
211
|
private PluginTask begin(final PluginTask task,
|
212
|
-
final Schema schema, int
|
212
|
+
final Schema schema, int taskCount)
|
213
213
|
{
|
214
214
|
try {
|
215
215
|
withRetry(new IdempotentSqlRunnable() { // no intermediate data if isDirectWrite == true
|
@@ -230,7 +230,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
230
230
|
}
|
231
231
|
|
232
232
|
private ConfigDiff commit(final PluginTask task,
|
233
|
-
Schema schema, final int
|
233
|
+
Schema schema, final int taskCount)
|
234
234
|
{
|
235
235
|
if (!task.getMode().isDirectWrite()) { // no intermediate data if isDirectWrite == true
|
236
236
|
try {
|
@@ -239,7 +239,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
239
239
|
{
|
240
240
|
JdbcOutputConnection con = newConnection(task, false, false);
|
241
241
|
try {
|
242
|
-
doCommit(con, task,
|
242
|
+
doCommit(con, task, taskCount);
|
243
243
|
} finally {
|
244
244
|
con.close();
|
245
245
|
}
|
@@ -253,7 +253,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
253
253
|
}
|
254
254
|
|
255
255
|
public void cleanup(TaskSource taskSource,
|
256
|
-
Schema schema, final int
|
256
|
+
Schema schema, final int taskCount,
|
257
257
|
final List<CommitReport> successCommitReports)
|
258
258
|
{
|
259
259
|
final PluginTask task = taskSource.loadTask(getTaskClass());
|
@@ -265,7 +265,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
265
265
|
{
|
266
266
|
JdbcOutputConnection con = newConnection(task, true, true);
|
267
267
|
try {
|
268
|
-
doCleanup(con, task,
|
268
|
+
doCleanup(con, task, taskCount, successCommitReports);
|
269
269
|
} finally {
|
270
270
|
con.close();
|
271
271
|
}
|
@@ -312,7 +312,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
312
312
|
task.setLoadSchema(matchSchemaByColumnNames(schema, targetTableSchema));
|
313
313
|
}
|
314
314
|
|
315
|
-
protected void doCommit(JdbcOutputConnection con, PluginTask task, int
|
315
|
+
protected void doCommit(JdbcOutputConnection con, PluginTask task, int taskCount)
|
316
316
|
throws SQLException
|
317
317
|
{
|
318
318
|
switch (task.getMode()) {
|
@@ -332,7 +332,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
332
332
|
throw new UnsupportedOperationException("not implemented yet");
|
333
333
|
//break;
|
334
334
|
case REPLACE:
|
335
|
-
if (
|
335
|
+
if (taskCount == 1) {
|
336
336
|
// swap table
|
337
337
|
con.replaceTable(task.getSwapTable().get(), task.getLoadSchema(), task.getTable());
|
338
338
|
} else {
|
@@ -347,7 +347,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
347
347
|
}
|
348
348
|
}
|
349
349
|
|
350
|
-
protected void doCleanup(JdbcOutputConnection con, PluginTask task, int
|
350
|
+
protected void doCleanup(JdbcOutputConnection con, PluginTask task, int taskCount,
|
351
351
|
List<CommitReport> successCommitReports)
|
352
352
|
throws SQLException
|
353
353
|
{
|
@@ -355,15 +355,15 @@ public abstract class AbstractJdbcOutputPlugin
|
|
355
355
|
con.dropTableIfExists(task.getSwapTable().get());
|
356
356
|
}
|
357
357
|
if (task.getMultipleLoadTablePrefix().isPresent()) {
|
358
|
-
for (int i=0; i <
|
358
|
+
for (int i=0; i < taskCount; i++) {
|
359
359
|
con.dropTableIfExists(formatMultipleLoadTableName(task, i));
|
360
360
|
}
|
361
361
|
}
|
362
362
|
}
|
363
363
|
|
364
|
-
static String formatMultipleLoadTableName(PluginTask task, int
|
364
|
+
static String formatMultipleLoadTableName(PluginTask task, int taskIndex)
|
365
365
|
{
|
366
|
-
return task.getMultipleLoadTablePrefix().get() + String.format("%04x",
|
366
|
+
return task.getMultipleLoadTablePrefix().get() + String.format("%04x", taskIndex);
|
367
367
|
}
|
368
368
|
|
369
369
|
protected JdbcSchema newJdbcSchemaForNewTable(Schema schema)
|
@@ -451,7 +451,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
451
451
|
return targetTableSchema;
|
452
452
|
}
|
453
453
|
|
454
|
-
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, final int
|
454
|
+
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, final int taskIndex)
|
455
455
|
{
|
456
456
|
final PluginTask task = taskSource.loadTask(getTaskClass());
|
457
457
|
final Mode mode = task.getMode();
|
@@ -488,7 +488,7 @@ public abstract class AbstractJdbcOutputPlugin
|
|
488
488
|
boolean createTable;
|
489
489
|
if (mode.usesMultipleLoadTables()) {
|
490
490
|
// insert, truncate_insert, merge, replace
|
491
|
-
loadTable = formatMultipleLoadTableName(task,
|
491
|
+
loadTable = formatMultipleLoadTableName(task, taskIndex);
|
492
492
|
JdbcOutputConnection con = newConnection(task, true, true);
|
493
493
|
try {
|
494
494
|
con.createTableIfNotExists(loadTable, insertSchema);
|
@@ -661,12 +661,12 @@ public abstract class AbstractJdbcOutputPlugin
|
|
661
661
|
|
662
662
|
public boolean isRetryableException(Throwable exception)
|
663
663
|
{
|
664
|
-
if (exception instanceof SQLException) {
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
}
|
664
|
+
//if (exception instanceof SQLException) {
|
665
|
+
// SQLException ex = (SQLException) exception;
|
666
|
+
// String sqlState = ex.getSQLState();
|
667
|
+
// int errorCode = ex.getErrorCode();
|
668
|
+
// return isRetryableSQLException(ex);
|
669
|
+
//}
|
670
670
|
return false; // TODO
|
671
671
|
}
|
672
672
|
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FURUHASHI Sadayuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: JDBC output plugin is an Embulk plugin that loads records to JDBC read by any input plugins. Search the input plugins by "embulk-input" keyword.
|
14
14
|
email:
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java
|
40
40
|
- src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java
|
41
41
|
- src/test/java/org/embulk/output/TestJdbcOutputPlugin.java
|
42
|
-
- classpath/embulk-output-jdbc-0.1.
|
42
|
+
- classpath/embulk-output-jdbc-0.1.1.jar
|
43
43
|
homepage: https://github.com/embulk/embulk-output-jdbc
|
44
44
|
licenses:
|
45
45
|
- Apache 2.0
|