embulk-input-jdbc 0.7.0 → 0.7.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: 5f5b564e877d141a046fdb04fc281bc9730af498
4
- data.tar.gz: aab75d9db9406b59446617ce03240b615db1f090
3
+ metadata.gz: fdf58a6bf2822d6fc08367c222f2cd6eab203d56
4
+ data.tar.gz: f68be4ab3068b33d4c35b824c4fed9068bd0c4a4
5
5
  SHA512:
6
- metadata.gz: 3924ef7b5698e9e9aaea6ed11763d3ff38acdb6bd963e352adca85912c6efc8ca12d0d159bf92d2b8e340e93e5585bfee3f668ef895bf7995c7eaf3d29155596
7
- data.tar.gz: cadb17a65f0b6a9e658f4d4e830841e7d44662bc668c4964a9c0f67918d836c8f88b9260bfe21ca4991c59a96cc002ba7b51260335a8d28dcd9f9478a0a43f59
6
+ metadata.gz: 7c52c12c901c33c8e8b1e4dfeb4a7ae68246f9257fcb7a9bf933f63dcb258e7e83e51167709c7ea21bbce92cf595095cb2efbe123cacd498b56359f75c9429f8
7
+ data.tar.gz: 237ab455d727b5f4831119534860448f06fb1f8ca90286c6f65d6efa232db7c975b3976f40bc8e660d294c9390636549d8d63117139f7b34906e26bc317fccdf
@@ -252,31 +252,36 @@ public abstract class AbstractJdbcInputPlugin
252
252
  BufferAllocator allocator = task.getBufferAllocator();
253
253
  PageBuilder pageBuilder = new PageBuilder(allocator, schema, output);
254
254
 
255
- try {
256
- List<ColumnGetter> getters = newColumnGetters(task, querySchema, pageBuilder);
257
-
258
- try (JdbcInputConnection con = newConnection(task)) {
259
- try (BatchSelect cursor = con.newSelectCursor(getQuery(task, con), task.getFetchRows(), task.getSocketTimeout())) {
260
- while (true) {
261
- // TODO run fetch() in another thread asynchronously
262
- // TODO retry fetch() if it failed (maybe order_by is required and unique_column(s) option is also required)
263
- boolean cont = fetch(cursor, getters, pageBuilder);
264
- if (!cont) {
265
- break;
266
- }
255
+ try (JdbcInputConnection con = newConnection(task)) {
256
+ try (BatchSelect cursor = con.newSelectCursor(getQuery(task, con), task.getFetchRows(), task.getSocketTimeout())) {
257
+ List<ColumnGetter> getters = newColumnGetters(task, querySchema, pageBuilder);
258
+ while (true) {
259
+ // TODO run fetch() in another thread asynchronously
260
+ // TODO retry fetch() if it failed (maybe order_by is required and unique_column(s) option is also required)
261
+ boolean cont = fetch(cursor, getters, pageBuilder);
262
+ if (!cont) {
263
+ break;
267
264
  }
268
265
  }
269
-
270
- if (task.getAfterSelect().isPresent()) {
271
- con.executeUpdate(task.getAfterSelect().get());
272
- con.connection.commit();
273
- }
274
266
  }
275
-
267
+ pageBuilder.finish();
268
+
269
+ // after_select runs after pageBuilder.finish because pageBuilder.finish may fail.
270
+ // TODO Output plugin's transaction might still fail. In that case, after_select is
271
+ // already done but output plugin didn't commit the data to the target storage.
272
+ // This means inconsistency between data source and destination. To avoid this
273
+ // issue, we need another option like `after_commit` that runs after output plugin's
274
+ // commit. after_commit can't run in the same transaction with SELECT. So,
275
+ // after_select gets values and store them in TaskReport, and after_commit take
276
+ // them as placeholder. Or, after_select puts values to an intermediate table, and
277
+ // after_commit moves those values to the actual table.
278
+ if (task.getAfterSelect().isPresent()) {
279
+ con.executeUpdate(task.getAfterSelect().get());
280
+ con.connection.commit();
281
+ }
276
282
  } catch (SQLException ex) {
277
283
  throw Throwables.propagate(ex);
278
284
  }
279
- pageBuilder.finish();
280
285
 
281
286
  TaskReport report = Exec.newTaskReport();
282
287
  // TODO
@@ -57,7 +57,10 @@ public abstract class AbstractColumnGetter implements ColumnGetter, ColumnVisito
57
57
  }
58
58
 
59
59
  @Override
60
- public void jsonColumn(Column column) { to.setNull(column); }
60
+ public void jsonColumn(Column column)
61
+ {
62
+ to.setNull(column);
63
+ }
61
64
 
62
65
  @Override
63
66
  public void timestampColumn(Column column)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -42,7 +42,7 @@ files:
42
42
  - src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
43
43
  - src/main/java/org/embulk/input/jdbc/getter/TimestampColumnGetter.java
44
44
  - src/test/java/org/embulk/input/EmbulkPluginTester.java
45
- - classpath/embulk-input-jdbc-0.7.0.jar
45
+ - classpath/embulk-input-jdbc-0.7.1.jar
46
46
  homepage: https://github.com/embulk/embulk-input-jdbc
47
47
  licenses:
48
48
  - Apache 2.0