embulk-output-mysql 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/classpath/{embulk-output-jdbc-0.8.3.jar → embulk-output-jdbc-0.8.4.jar} +0 -0
- data/classpath/{embulk-output-mysql-0.8.3.jar → embulk-output-mysql-0.8.4.jar} +0 -0
- data/src/test/java/org/embulk/output/mysql/RetryTest.java +68 -4
- data/src/test/resources/org/embulk/output/mysql/test/expect/retry/setup.sql +1 -1
- data/src/test/resources/org/embulk/output/mysql/test/expect/retry/{test1_large.csv → test1_flushed_multiple_times.csv} +0 -0
- data/src/test/resources/org/embulk/output/mysql/test/expect/retry/{test1_large.yml → test1_flushed_multiple_times.yml} +0 -0
- data/src/test/resources/org/embulk/output/mysql/test/expect/retry/{test1_large_expected.csv → test1_flushed_multiple_times_expected.csv} +0 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd951816256b91bd4c8ea18655cb69cce02d800
|
4
|
+
data.tar.gz: 7f85745159a29910334433785030c998318cefad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2defc0817f7e6bf4671131875e51e2c063c1295a4f31b8d1759ba6755888f7a190c448d13e5c1e651f63ba57078fc1b03d73676ffb39a940dcb21878337889b5
|
7
|
+
data.tar.gz: 67b7e2158febcbb3d8c766d8726ddf8ec1f89a597ec64aa089c6d0511f58859c203ebf6ad5fc15373ea3c63746c020406e054e49a778c4d2a88d7598cd5f753c
|
Binary file
|
Binary file
|
@@ -5,7 +5,9 @@ import static org.embulk.output.mysql.MySQLTests.selectRecords;
|
|
5
5
|
import static org.hamcrest.Matchers.is;
|
6
6
|
import static org.junit.Assert.assertThat;
|
7
7
|
|
8
|
+
import java.io.BufferedWriter;
|
8
9
|
import java.io.File;
|
10
|
+
import java.io.FileWriter;
|
9
11
|
import java.net.URISyntaxException;
|
10
12
|
import java.net.URL;
|
11
13
|
import java.nio.file.FileSystems;
|
@@ -97,7 +99,7 @@ public class RetryTest
|
|
97
99
|
|
98
100
|
// will be flushed multiple times
|
99
101
|
@Test
|
100
|
-
public void
|
102
|
+
public void testRetry_FlushedMultipleTimes() throws Exception
|
101
103
|
{
|
102
104
|
Thread thread = new Thread() {
|
103
105
|
@Override
|
@@ -125,9 +127,71 @@ public class RetryTest
|
|
125
127
|
};
|
126
128
|
thread.start();
|
127
129
|
|
128
|
-
Path in1 = toPath("
|
129
|
-
TestingEmbulk.RunResult result1 = embulk.runOutput(baseConfig.merge(loadYamlResource(embulk, "
|
130
|
-
assertThat(selectRecords(embulk, "test1"), is(readResource("
|
130
|
+
Path in1 = toPath("test1_flushed_multiple_times.csv");
|
131
|
+
TestingEmbulk.RunResult result1 = embulk.runOutput(baseConfig.merge(loadYamlResource(embulk, "test1_flushed_multiple_times.yml")), in1);
|
132
|
+
assertThat(selectRecords(embulk, "test1"), is(readResource("test1_flushed_multiple_times_expected.csv")));
|
133
|
+
}
|
134
|
+
|
135
|
+
// records will be partially committed
|
136
|
+
@Test
|
137
|
+
public void testRetry_Large() throws Exception
|
138
|
+
{
|
139
|
+
Path in1 = embulk.createTempFile("csv");
|
140
|
+
StringBuilder expected1 = new StringBuilder();
|
141
|
+
|
142
|
+
try (BufferedWriter writer = new BufferedWriter(new FileWriter(in1.toFile()))) {
|
143
|
+
writer.write("id:string,num:long");
|
144
|
+
writer.newLine();
|
145
|
+
|
146
|
+
for (int i = 1000000; i < 1250000; i++) {
|
147
|
+
writer.write("A" + i + "," + i);
|
148
|
+
writer.newLine();
|
149
|
+
|
150
|
+
expected1.append("A" + i + "," + i + "\n");
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
final Object lock = new Object();
|
155
|
+
|
156
|
+
Thread thread = new Thread() {
|
157
|
+
@Override
|
158
|
+
public void run() {
|
159
|
+
try {
|
160
|
+
try (Connection conn = MySQLTests.connect()) {
|
161
|
+
conn.setAutoCommit(false);
|
162
|
+
try (Statement statement = conn.createStatement()) {
|
163
|
+
// make the transaction larger so that embulk-output-mysql transaction will be rolled back at a deadlock.
|
164
|
+
for (int i = 1000000; i < 1260000; i++) {
|
165
|
+
statement.execute("insert into test1 values('B" + i + "', 0)");
|
166
|
+
}
|
167
|
+
|
168
|
+
synchronized (lock) {
|
169
|
+
lock.notify();
|
170
|
+
}
|
171
|
+
|
172
|
+
System.out.println("##1");
|
173
|
+
|
174
|
+
statement.execute("insert into test1 values('A1249010', 0)");
|
175
|
+
Thread.sleep(5000);
|
176
|
+
// deadlock will occur
|
177
|
+
statement.execute("insert into test1 values('A1249000', 0)");
|
178
|
+
conn.rollback();
|
179
|
+
}
|
180
|
+
}
|
181
|
+
} catch (Exception e) {
|
182
|
+
e.printStackTrace();
|
183
|
+
}
|
184
|
+
}
|
185
|
+
};
|
186
|
+
thread.start();
|
187
|
+
|
188
|
+
synchronized (lock) {
|
189
|
+
lock.wait();
|
190
|
+
}
|
191
|
+
|
192
|
+
//Path in1 = toPath("test1_flushed_multiple_times.csv");
|
193
|
+
TestingEmbulk.RunResult result1 = embulk.runOutput(baseConfig.merge(loadYamlResource(embulk, "test1.yml")), in1);
|
194
|
+
assertThat(selectRecords(embulk, "test1"), is(expected1.toString()));
|
131
195
|
}
|
132
196
|
|
133
197
|
private Path toPath(String fileName) throws URISyntaxException
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Inserts or updates records to a table.
|
14
14
|
email:
|
@@ -19,8 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- build.gradle
|
22
|
-
- classpath/embulk-output-jdbc-0.8.
|
23
|
-
- classpath/embulk-output-mysql-0.8.
|
22
|
+
- classpath/embulk-output-jdbc-0.8.4.jar
|
23
|
+
- classpath/embulk-output-mysql-0.8.4.jar
|
24
24
|
- default_jdbc_driver/mysql-connector-java-5.1.44.jar
|
25
25
|
- lib/embulk/output/mysql.rb
|
26
26
|
- src/main/java/org/embulk/output/MySQLOutputPlugin.java
|
@@ -67,9 +67,9 @@ files:
|
|
67
67
|
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1.csv
|
68
68
|
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1.yml
|
69
69
|
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1_expected.csv
|
70
|
-
- src/test/resources/org/embulk/output/mysql/test/expect/retry/
|
71
|
-
- src/test/resources/org/embulk/output/mysql/test/expect/retry/
|
72
|
-
- src/test/resources/org/embulk/output/mysql/test/expect/retry/
|
70
|
+
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1_flushed_multiple_times.csv
|
71
|
+
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1_flushed_multiple_times.yml
|
72
|
+
- src/test/resources/org/embulk/output/mysql/test/expect/retry/test1_flushed_multiple_times_expected.csv
|
73
73
|
homepage: https://github.com/embulk/embulk-output-jdbc
|
74
74
|
licenses:
|
75
75
|
- Apache 2.0
|