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

Keep stop_time ,remove stop_time_millis at Pipeline job config properties #29277

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -17,17 +17,16 @@

package org.apache.shardingsphere.data.pipeline.opengauss.ingest;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.core.ingest.dumper.context.IncrementalDumperContext;
import org.apache.shardingsphere.data.pipeline.api.type.StandardPipelineDataSourceConfiguration;
import org.apache.shardingsphere.data.pipeline.common.execute.AbstractPipelineLifecycleRunnable;
import org.apache.shardingsphere.data.pipeline.common.metadata.loader.PipelineTableMetaDataLoader;
import org.apache.shardingsphere.data.pipeline.core.exception.IngestException;
import org.apache.shardingsphere.data.pipeline.core.ingest.channel.PipelineChannel;
import org.apache.shardingsphere.data.pipeline.core.ingest.dumper.IncrementalDumper;
import org.apache.shardingsphere.data.pipeline.core.ingest.dumper.context.IncrementalDumperContext;
import org.apache.shardingsphere.data.pipeline.core.ingest.position.IngestPosition;
import org.apache.shardingsphere.data.pipeline.core.ingest.record.Record;
import org.apache.shardingsphere.data.pipeline.common.metadata.loader.PipelineTableMetaDataLoader;
import org.apache.shardingsphere.data.pipeline.core.exception.IngestException;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.OpenGaussLogicalReplication;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.decode.MppdbDecodingPlugin;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.decode.OpenGaussLogSequenceNumber;
Expand Down Expand Up @@ -84,7 +83,6 @@ public OpenGaussWALDumper(final IncrementalDumperContext dumperContext, final In
this.decodeWithTX = dumperContext.isDecodeWithTX();
}

@SneakyThrows(InterruptedException.class)
@Override
protected void runBlocking() {
AtomicInteger reconnectTimes = new AtomicInteger();
Expand All @@ -96,7 +94,7 @@ protected void runBlocking() {
int times = reconnectTimes.incrementAndGet();
log.error("Connect failed, reconnect times={}", times, ex);
if (isRunning()) {
Thread.sleep(5000L);
sleepIgnoreInterrupt(5000L);
azexcy marked this conversation as resolved.
Show resolved Hide resolved
}
if (times >= 5) {
throw new IngestException(ex);
Expand All @@ -105,7 +103,13 @@ protected void runBlocking() {
}
}

@SneakyThrows(InterruptedException.class)
private void sleepIgnoreInterrupt(final long millis) {
try {
Thread.sleep(millis);
} catch (final InterruptedException ignored) {
}
}

private void dump() throws SQLException {
PGReplicationStream stream = null;
try (PgConnection connection = getReplicationConnectionUnwrap()) {
Expand All @@ -115,7 +119,7 @@ private void dump() throws SQLException {
while (isRunning()) {
ByteBuffer message = stream.readPending();
if (null == message) {
Thread.sleep(10L);
sleepIgnoreInterrupt(5000L);
continue;
}
AbstractWALEvent event = decodingPlugin.decode(message, new OpenGaussLogSequenceNumber(stream.getLastReceiveLSN()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ private void enable(final String jobId) {
jobConfigPOJO.setDisabled(false);
jobConfigPOJO.getProps().setProperty("start_time_millis", String.valueOf(System.currentTimeMillis()));
jobConfigPOJO.getProps().remove("stop_time_millis");
jobConfigPOJO.getProps().remove("stop_time");
azexcy marked this conversation as resolved.
Show resolved Hide resolved
PipelineAPIFactory.getJobConfigurationAPI(PipelineJobIdUtils.parseContextKey(jobConfigPOJO.getJobName())).updateJobConfiguration(jobConfigPOJO);
}

Expand Down