Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misleading messages logged by SpoolDirLineDelimitedSourceConnector #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,27 +180,27 @@ public static String humanReadableByteCount(long bytes, boolean si) {
}

private void recordProcessingTime() {
final long secondsElapsed = processingTime.elapsed(TimeUnit.SECONDS);
final long bytesPerSecond;
final long elapsedMs = processingTime.elapsed(TimeUnit.MILLISECONDS);
final long bytesPerMs;

if (0L == secondsElapsed || 0L == this.inputFile.length()) {
bytesPerSecond = 0L;
if (0L == elapsedMs || 0L == this.inputFile.length()) {
bytesPerMs = 0L;
} else {
bytesPerSecond = this.inputFile.length() / secondsElapsed;
bytesPerMs = this.inputFile.length() / elapsedMs;
}

if (bytesPerSecond > 0) {
if (bytesPerMs > 0) {
log.info(
"Finished processing {} record(s) in {} second(s). Processing speed {} per second.",
"Finished processing {} record(s) in {} millisecond(s). Processing speed {} per millisecond.",
this.recordCount,
secondsElapsed,
humanReadableByteCount(bytesPerSecond, false)
elapsedMs,
humanReadableByteCount(bytesPerMs, false)
);
} else {
log.info(
"Finished processing {} record(s) in {} second(s).",
this.recordCount,
secondsElapsed
elapsedMs
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ private List<File> getInputPathSubDirsToCleanup() {
File lastSubDir = this.config.inputPath;
for (String subDirName : this.inputPathSubDir.split(File.separator)) {
lastSubDir = new File(lastSubDir, subDirName);
inputPathSubDirsToCleanup.add(lastSubDir);
if (lastSubDir.exists()) {
inputPathSubDirsToCleanup.add(lastSubDir);
}
}
Collections.reverse(inputPathSubDirsToCleanup);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ protected void configure(InputFile inputFile, Long lastOffset) throws IOExceptio

@Override
protected List<SourceRecord> process() throws IOException {
int recordCount = 0;
List<SourceRecord> records = new ArrayList<>(this.config.batchSize);
String line = null;
while (recordCount < this.config.batchSize && null != (line = this.inputFile.lineNumberReader().readLine())) {
Expand Down