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

feat(dlm): response the comments on #4151 #4165

Open
wants to merge 2 commits into
base: dev/4.3.x
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 @@ -57,6 +57,10 @@ public boolean isODPSharding() {
return this == ODP_SHARDING_OB_MYSQL || this == ODP_SHARDING_OB_ORACLE;
}

public boolean isFileSystem() {
return this == COS || this == OBS || this == OSS || this == S3A;
}

public boolean isDefaultSchemaRequired() {
return isODPSharding();
}
Expand Down
10 changes: 0 additions & 10 deletions server/odc-server/src/main/resources/log4j2-task.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@
<!-- TRACE < DEBUG < INFO < WARN < ERROR < FATAL -->
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<OnStartupTriggeringPolicy/>
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
</Route>
</Routes>
Expand All @@ -92,11 +87,6 @@
<!-- TRACE < DEBUG < INFO < WARN < ERROR < FATAL -->
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<OnStartupTriggeringPolicy/>
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
</RollingFile>
</Route>
</Routes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import com.oceanbase.odc.common.event.AbstractEvent;
import com.oceanbase.odc.common.event.LocalEventPublisher;
import com.oceanbase.odc.service.connection.listener.UpdateDatasourceListener;
import com.oceanbase.odc.service.connection.listener.UpsertFileSystemListener;

import lombok.NonNull;

Expand All @@ -38,11 +38,11 @@ public class ConnectionEventPublisher {
private LocalEventPublisher localEventPublisher;

@Autowired
private UpdateDatasourceListener updateDatasourceListener;
private UpsertFileSystemListener upsertFileSystemListener;

@PostConstruct
public void init() {
localEventPublisher.addEventListener(updateDatasourceListener);
localEventPublisher.addEventListener(upsertFileSystemListener);
}

public <T extends AbstractEvent> void publishEvent(@NonNull T event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public ConnectionTestResult test(@NotNull @Valid TestConnectionReq req) {

public ConnectionTestResult test(@NonNull ConnectionConfig config) {
ConnectType type = config.getType();
if (type.getDialectType() == DialectType.FILE_SYSTEM) {
if (type != null && type.isFileSystem()) {
return fileSystemConnectionTesting.test(config);
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.springframework.stereotype.Component;

import com.oceanbase.odc.core.shared.PreConditions;
import com.oceanbase.odc.core.shared.constant.DialectType;
import com.oceanbase.odc.core.shared.constant.ErrorCodes;
import com.oceanbase.odc.core.shared.exception.AccessDeniedException;
import com.oceanbase.odc.service.collaboration.environment.EnvironmentService;
Expand All @@ -44,7 +43,7 @@ public class ConnectionValidator {
void validateForUpsert(ConnectionConfig connection) {
PreConditions.notNull(connection, "connection");
PreConditions.notBlank(connection.getHost(), "connection.host");
if (connection.getDialectType() != DialectType.FILE_SYSTEM) {
if (!connection.getType().isFileSystem()) {
PreConditions.notNull(connection.getPort(), "connection.port");
}
PreConditions.validNotSqlInjection(connection.getUsername(), "username");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import com.oceanbase.odc.core.authority.util.SkipAuthorize;
import com.oceanbase.odc.core.session.ConnectionSession;
import com.oceanbase.odc.core.shared.PreConditions;
import com.oceanbase.odc.core.shared.constant.DialectType;
import com.oceanbase.odc.core.shared.constant.ErrorCodes;
import com.oceanbase.odc.core.shared.constant.OrganizationType;
import com.oceanbase.odc.core.shared.constant.ResourceRoleName;
Expand Down Expand Up @@ -529,7 +528,7 @@ public Boolean internalSyncDataSourceSchemas(@NonNull Long dataSourceId) throws
Optional<Organization> organizationOpt = Optional.empty();
try {
connection = connectionService.getForConnectionSkipPermissionCheck(dataSourceId);
if (connection.getDialectType() == DialectType.FILE_SYSTEM) {
if (connection.getType().isFileSystem()) {
return true;
}
horizontalDataPermissionValidator.checkCurrentOrganization(connection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.util.CollectionUtils;

import com.oceanbase.odc.common.event.AbstractEventListener;
import com.oceanbase.odc.core.shared.constant.DialectType;
import com.oceanbase.odc.common.util.StringUtils;
import com.oceanbase.odc.metadb.connection.DatabaseEntity;
import com.oceanbase.odc.metadb.connection.DatabaseRepository;
import com.oceanbase.odc.service.connection.database.model.DatabaseSyncStatus;
Expand All @@ -42,7 +42,7 @@
*/
@Slf4j
@Component
public class UpdateDatasourceListener extends AbstractEventListener<UpsertDatasourceEvent> {
public class UpsertFileSystemListener extends AbstractEventListener<UpsertDatasourceEvent> {

@Autowired
private DatabaseRepository databaseRepository;
Expand All @@ -51,7 +51,7 @@ public class UpdateDatasourceListener extends AbstractEventListener<UpsertDataso
public void onEvent(UpsertDatasourceEvent event) {

ConnectionConfig connectionConfig = event.getConnectionConfig();
if (connectionConfig.getDialectType() != DialectType.FILE_SYSTEM) {
if (!connectionConfig.getType().isFileSystem()) {
return;
}
List<DatabaseEntity> byConnectionId = databaseRepository.findByConnectionId(connectionConfig.getId());
Expand All @@ -71,7 +71,7 @@ public void onEvent(UpsertDatasourceEvent event) {
}
// create or update
entity = entity == null ? new DatabaseEntity() : entity;
entity.setDatabaseId(com.oceanbase.odc.common.util.StringUtils.uuid());
entity.setDatabaseId(StringUtils.uuid());
entity.setOrganizationId(connectionConfig.getOrganizationId());
entity.setName(connectionConfig.getHost());
entity.setProjectId(connectionConfig.getProjectId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.oceanbase.odc.core.shared.constant.DialectType;
import com.oceanbase.odc.core.shared.constant.ResourceType;
import com.oceanbase.odc.core.shared.exception.ConflictException;
import com.oceanbase.odc.core.shared.exception.NotFoundException;
Expand Down Expand Up @@ -119,7 +118,7 @@ public void submitTaskByDatabases(@NonNull Collection<Database> databases) {
}

public void submitTaskByDataSource(@NonNull ConnectionConfig dataSource) {
if (dataSource.getDialectType() == DialectType.FILE_SYSTEM) {
if (dataSource.getType().isFileSystem()) {
return;
}
List<Database> databases = databaseService.listExistDatabasesByConnectionId(dataSource.getId());
Expand Down
Loading