This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
forked from vdesabou/kafka-docker-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertica-sink-testing-batch-size-error.sh
executable file
·169 lines (148 loc) · 10.4 KB
/
vertica-sink-testing-batch-size-error.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${DIR}/../../scripts/utils.sh
if [ ! -f ${DIR}/vertica-jdbc.jar ]
then
# install deps
log "Getting vertica-jdbc.jar from vertica-client-10.0.1-0.x86_64.tar.gz"
wget https://www.vertica.com/client_drivers/10.0.x/10.0.1-0/vertica-client-10.0.1-0.x86_64.tar.gz
tar xvfz ${DIR}/vertica-client-10.0.1-0.x86_64.tar.gz
cp ${DIR}/opt/vertica/java/lib/vertica-jdbc.jar ${DIR}/
rm -rf ${DIR}/opt
rm -f ${DIR}/vertica-client-10.0.1-0.x86_64.tar.gz
fi
${DIR}/../../environment/plaintext/start.sh "${PWD}/docker-compose.plaintext.yml"
###
# f1 varchar(2) whereas we set 6 characters string
###
# batch.size = 3000 (default)
###
log "Create the table mytabledefaultbatchsize and insert data."
docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
create table mytabledefaultbatchsize(f1 varchar(2));
EOF
sleep 2
log "Sending messages to topic mytabledefaultbatchsize"
seq -f "{\"f1\": \"value%g\"}" 10 | docker exec -i connect kafka-avro-console-producer --broker-list broker:9092 --property schema.registry.url=http://schema-registry:8081 --topic mytabledefaultbatchsize --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'
log "Creating JDBC Vertica sink connector - default batch.size (3000)"
curl -X PUT \
-H "Content-Type: application/json" \
--data '{
"connector.class" : "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max" : "1",
"connection.url": "jdbc:vertica://vertica:5433/docker?user=dbadmin&password=",
"auto.create": "true",
"topics": "mytabledefaultbatchsize",
"errors.tolerance": "all",
"errors.log.enable":true,
"errors.log.include.messages":true
}' \
http://localhost:8083/connectors/jdbc-vertica-sink/config | jq .
sleep 10
log "Check data is in Vertica"
docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
select * from mytabledefaultbatchsize;
EOF
# [2020-01-16 14:49:15,631] ERROR WorkerSinkTask{id=jdbc-vertica-sink-0} RetriableException from SinkTask: (org.apache.kafka.connect.runtime.WorkerSinkTask)
# org.apache.kafka.connect.errors.RetriableException: java.sql.SQLException: java.sql.BatchUpdateException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:93)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:539)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:224)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:192)
# at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
# at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
# at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
# at java.util.concurrent.FutureTask.run(FutureTask.java:266)
# at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
# at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
# at java.lang.Thread.run(Thread.java:748)
# Caused by: java.sql.SQLException: java.sql.BatchUpdateException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# java.sql.SQLException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
# com.vertica.support.exceptions.ErrorException: [Vertica][VJDBC](100172) One or more rows were rejected by the server.
###
# batch.size = 1
###
log "Create the table mytablebatchsizeone and insert data."
docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
create table mytablebatchsizeone(f1 varchar(2));
EOF
sleep 2
log "Sending messages to topic mytablebatchsizeone"
seq -f "{\"f1\": \"value%g\"}" 10 | docker exec -i connect kafka-avro-console-producer --broker-list broker:9092 --property schema.registry.url=http://schema-registry:8081 --topic mytablebatchsizeone --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'
log "Creating JDBC Vertica sink connector - batch.size (1)"
curl -X PUT \
-H "Content-Type: application/json" \
--data '{
"connector.class" : "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max" : "1",
"connection.url": "jdbc:vertica://vertica:5433/docker?user=dbadmin&password=",
"auto.create": "true",
"topics": "mytablebatchsizeone",
"batch.size": "1",
"errors.tolerance": "all",
"errors.log.enable":true,
"errors.log.include.messages":true
}' \
http://localhost:8083/connectors/jdbc-vertica-sink/config | jq .
sleep 10
log "Check data is in Vertica"
docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
select * from mytablebatchsizeone;
EOF
# [2020-01-16 14:49:45,207] WARN Write of 10 records failed, remainingRetries=6 (io.confluent.connect.jdbc.sink.JdbcSinkTask)
# java.sql.BatchUpdateException: [Vertica][VJDBC](4800) ERROR: String of 6 octets is too long for type Varchar(2)
# at com.vertica.jdbc.common.SStatement.processBatchResults(Unknown Source)
# at com.vertica.jdbc.common.SPreparedStatement.executeBatch(Unknown Source)
# at com.vertica.jdbc.VerticaJdbc4PreparedStatementImpl.executeBatch(Unknown Source)
# at io.confluent.connect.jdbc.sink.BufferedRecords.executeUpdates(BufferedRecords.java:211)
# at io.confluent.connect.jdbc.sink.BufferedRecords.flush(BufferedRecords.java:177)
# at io.confluent.connect.jdbc.sink.BufferedRecords.add(BufferedRecords.java:159)
# at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:66)
# at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:74)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:539)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:224)
# at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:192)
# at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
# at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
# at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
# at java.util.concurrent.FutureTask.run(FutureTask.java:266)
# at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
# at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
# at java.lang.Thread.run(Thread.java:748)