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

Remove redis transaction #280

Merged
merged 1 commit into from
Oct 30, 2019
Merged
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 @@ -138,12 +138,16 @@ public static class WriteDoFn extends DoFn<RedisMutation, Void> {
}

public WriteDoFn withBatchSize(int batchSize) {
if (batchSize > 0) this.batchSize = batchSize;
if (batchSize > 0) {
this.batchSize = batchSize;
}
return this;
}

public WriteDoFn withTimeout(int timeout) {
if (timeout > 0) this.timeout = timeout;
if (timeout > 0) {
this.timeout = timeout;
}
return this;
}

Expand All @@ -155,7 +159,6 @@ public void setup() {
@StartBundle
public void startBundle() {
pipeline = jedis.pipelined();
pipeline.multi();
batchCount = 0;
}

Expand All @@ -168,9 +171,7 @@ public void processElement(ProcessContext context) {
}
batchCount++;
if (batchCount >= batchSize) {
pipeline.exec();
pipeline.sync();
pipeline.multi();
batchCount = 0;
}
}
Expand All @@ -197,10 +198,7 @@ private Response<?> writeRecord(RedisMutation mutation) {

@FinishBundle
public void finishBundle() {
if (pipeline.isInMulti()) {
pipeline.exec();
pipeline.sync();
}
pipeline.sync();
batchCount = 0;
}

Expand Down