Skip to content

Commit 25bd681

Browse files
committed
Merge pull request confluentinc#45 from confluentinc/logs
added some logging. hopefully more useful than annoying while trouble…
2 parents c647674 + a34c6b4 commit 25bd681

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/main/java/io/confluent/connect/jdbc/JdbcSourceTask.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public List<SourceRecord> poll() throws InterruptedException {
202202

203203
List<SourceRecord> results = new ArrayList<>();
204204
try {
205-
log.trace("Checking for next block of results from {}", querier.toString());
205+
log.debug("Checking for next block of results from {}", querier.toString());
206206
querier.maybeStartQuery(db);
207207

208208
int batchMaxRows = config.getInt(JdbcSourceTaskConfig.BATCH_MAX_ROWS_CONFIG);
@@ -211,9 +211,10 @@ public List<SourceRecord> poll() throws InterruptedException {
211211
results.add(querier.extractRecord());
212212
}
213213

214+
214215
// If we finished processing the results from this query, we can clear it out
215216
if (!hadNext) {
216-
log.trace("Closing this query for {}", querier.toString());
217+
log.debug("Closing this query for {}", querier.toString());
217218
TableQuerier removedQuerier = tableQueue.poll();
218219
assert removedQuerier == querier;
219220
now = time.milliseconds();
@@ -226,7 +227,7 @@ public List<SourceRecord> poll() throws InterruptedException {
226227
continue;
227228
}
228229

229-
log.trace("Returning {} records for {}", results.size(), querier.toString());
230+
log.debug("Returning {} records for {}", results.size(), querier.toString());
230231
return results;
231232
} catch (SQLException e) {
232233
log.error("Failed to run query for table {}: {}", querier.toString(), e);

src/main/java/io/confluent/connect/jdbc/TableMonitorThread.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.sql.Connection;
2525
import java.sql.SQLException;
2626
import java.util.ArrayList;
27+
import java.util.Arrays;
2728
import java.util.List;
2829
import java.util.Set;
2930
import java.util.concurrent.CountDownLatch;
@@ -103,6 +104,7 @@ private boolean updateTables() {
103104
final List<String> tables;
104105
try {
105106
tables = JdbcUtils.getTables(db);
107+
log.debug("Got the following tables: " + Arrays.toString(tables.toArray()));
106108
} catch (SQLException e) {
107109
log.error("Error while trying to get updated table list, ignoring and waiting for next "
108110
+ "table poll interval", e);
@@ -129,6 +131,7 @@ private boolean updateTables() {
129131
}
130132

131133
if (!filteredTables.equals(this.tables)) {
134+
log.debug("After filtering we got tables: " + Arrays.toString(filteredTables.toArray()));
132135
List<String> previousTables = this.tables;
133136
this.tables = filteredTables;
134137
db.notifyAll();

src/main/java/io/confluent/connect/jdbc/TimestampIncrementingTableQuerier.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,14 @@ protected ResultSet executeQuery() throws SQLException {
151151
stmt.setTimestamp(1, ts, UTC_CALENDAR);
152152
stmt.setLong(2, (incrementingOffset == null ? -1 : incrementingOffset));
153153
stmt.setTimestamp(3, ts, UTC_CALENDAR);
154+
log.debug("Executing prepared statement with timestamp value = " + timestampOffset + " and incrementing value = " + incrementingOffset);
154155
} else if (incrementingColumn != null) {
155156
stmt.setLong(1, (incrementingOffset == null ? -1 : incrementingOffset));
157+
log.debug("Executing prepared statement with incrementing value = " + incrementingOffset);
156158
} else if (timestampColumn != null) {
157159
Timestamp ts = new Timestamp(timestampOffset == null ? 0 : timestampOffset);
158160
stmt.setTimestamp(1, ts, UTC_CALENDAR);
161+
log.debug("Executing prepared statement with timestamp value = " + timestampOffset);
159162
}
160163
return stmt.executeQuery();
161164
}

0 commit comments

Comments
 (0)