Browse Source

[BUG-7554] Fix database lose data in standalone (#7620)

* Fix the wrong lifecycle phase of initialization

Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
3.0.0/version-upgrade
wind 3 years ago committed by GitHub
parent
commit
f450b7ef28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/aspect/AccessLogAnnotation.java
  2. 5
      dolphinscheduler-standalone-server/src/main/resources/application.yaml
  3. 6
      dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/aspect/AccessLogAnnotation.java

@ -28,7 +28,7 @@ import java.lang.annotation.Target;
@Documented @Documented
public @interface AccessLogAnnotation { public @interface AccessLogAnnotation {
// ignore request args // ignore request args
String[] ignoreRequestArgs() default {}; String[] ignoreRequestArgs() default {"loginUser"};
boolean ignoreRequest() default false; boolean ignoreRequest() default false;

5
dolphinscheduler-standalone-server/src/main/resources/application.yaml

@ -31,9 +31,12 @@ spring:
- taskDefinition - taskDefinition
caffeine: caffeine:
spec: maximumSize=100,expireAfterWrite=300s,recordStats spec: maximumSize=100,expireAfterWrite=300s,recordStats
sql:
init:
schema-locations: classpath:sql/dolphinscheduler_h2.sql
datasource: datasource:
driver-class-name: org.h2.Driver driver-class-name: org.h2.Driver
url: jdbc:h2:mem:dolphinscheduler;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;INIT=runscript from 'classpath:sql/dolphinscheduler_h2.sql' url: jdbc:h2:mem:dolphinscheduler;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true
username: sa username: sa
password: "" password: ""
quartz: quartz:

6
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java

@ -39,6 +39,8 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@ -62,8 +64,8 @@ public class TaskPluginManager {
return Collections.unmodifiableMap(taskChannelMap); return Collections.unmodifiableMap(taskChannelMap);
} }
@PostConstruct @EventListener
public void installPlugin() { public void installPlugin(ApplicationReadyEvent readyEvent) {
final Set<String> names = new HashSet<>(); final Set<String> names = new HashSet<>();
ServiceLoader.load(TaskChannelFactory.class).forEach(factory -> { ServiceLoader.load(TaskChannelFactory.class).forEach(factory -> {

Loading…
Cancel
Save