Skip to content

Commit

Permalink
Merge branch 'dev-12123' into dev-12122
Browse files Browse the repository at this point in the history
  • Loading branch information
strongduanmu committed Dec 12, 2024
2 parents 618ace2 + a7ef4be commit 0399ba4
Show file tree
Hide file tree
Showing 63 changed files with 112 additions and 113 deletions.
10 changes: 9 additions & 1 deletion distribution/proxy/src/main/resources/bin/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

cd %~dp0

set LOGS_DIR=..\logs

if not exist %LOGS_DIR% (
mkdir %LOGS_DIR%
)

set STDOUT_FILE=%LOGS_DIR%\stdout.log

set SERVER_NAME=ShardingSphere-Proxy

set CLASS_PATH="..;..\lib\*;..\ext-lib\*"
Expand Down Expand Up @@ -81,7 +89,7 @@ if %int_version% == 8 (

echo Starting the %SERVER_NAME% ...

java -server -Xmx2g -Xms2g -Xmn1g -Xss1m -XX:AutoBoxCacheMax=4096 -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m %VERSION_OPTS% -Dfile.encoding=UTF-8 -Dio.netty.leakDetection.level=DISABLED -classpath %CLASS_PATH% %MAIN_CLASS%
javaw -server -Xmx2g -Xms2g -Xmn1g -Xss1m -XX:AutoBoxCacheMax=4096 -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m %VERSION_OPTS% -Dfile.encoding=UTF-8 -Dio.netty.leakDetection.level=DISABLED -classpath %CLASS_PATH% %MAIN_CLASS% >> %STDOUT_FILE% 2>&1

goto exit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.apache.shardingsphere.mode.lock.GlobalLockContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.lock.GlobalLockPersistService;
import org.apache.shardingsphere.mode.manager.cluster.persist.GlobalLockPersistService;
import org.apache.shardingsphere.mode.metadata.refresher.ShardingSphereStatisticsRefreshEngine;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.mode.spi.PersistRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.ContextManagerBuilder;
import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDeliverEventSubscriberRegistry;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry;
import org.apache.shardingsphere.mode.manager.cluster.event.deliver.subscriber.ClusterDeliverEventSubscriberRegistry;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber.ClusterDispatchEventSubscriberRegistry;
import org.apache.shardingsphere.mode.manager.cluster.exception.MissingRequiredClusterRepositoryConfigurationException;
import org.apache.shardingsphere.mode.manager.cluster.listener.DataChangedEventListenerRegistry;
import org.apache.shardingsphere.mode.manager.cluster.lock.GlobalLockPersistService;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener.DataChangedEventListenerRegistry;
import org.apache.shardingsphere.mode.manager.cluster.persist.GlobalLockPersistService;
import org.apache.shardingsphere.mode.manager.cluster.workerid.ClusterWorkerIdGenerator;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry;
package org.apache.shardingsphere.mode.manager.cluster.event.deliver.subscriber;

import lombok.Getter;
import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.deliver.DeliverQualifiedDataSourceSubscriber;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.deliver;
package org.apache.shardingsphere.mode.manager.cluster.event.deliver.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.infra.state.cluster.ClusterState;
import org.apache.shardingsphere.metadata.persist.node.StatesNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.infra.instance.ComputeNodeData;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.metadata.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.metadata.persist.node.ComputeNode;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.metadata.persist.node.StatesNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.metadata.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.builder;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder;

import org.apache.shardingsphere.metadata.persist.node.ComputeNode;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.listener;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener;

import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.metadata.persist.node.DatabaseMetaDataNode;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.event.builder.DispatchEventBuilder;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder.DispatchEventBuilder;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.listener;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener;

import com.google.common.base.Preconditions;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.listener;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener;

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.event.builder.DispatchEventBuilder;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder.DispatchEventBuilder;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.mode.event.dispatch.DispatchEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,11 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import lombok.Getter;
import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.CacheEvictedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ComputeNodeStateSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.DatabaseDataChangedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.GlobalRuleConfigurationEventSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ListenerAssistedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ProcessListChangedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.PropertiesEventSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.QualifiedDataSourceSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.RuleItemChangedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StateChangedSubscriber;
import org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StorageUnitEventSubscriber;

import java.util.Arrays;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand All @@ -26,8 +26,8 @@
import org.apache.shardingsphere.mode.event.dispatch.assisted.DropDatabaseListenerAssistedEvent;
import org.apache.shardingsphere.mode.lock.GlobalLockContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.listener.DatabaseMetaDataChangedListener;
import org.apache.shardingsphere.mode.manager.cluster.lock.GlobalLockPersistService;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener.DatabaseMetaDataChangedListener;
import org.apache.shardingsphere.mode.manager.cluster.persist.GlobalLockPersistService;
import org.apache.shardingsphere.mode.metadata.refresher.ShardingSphereStatisticsRefreshEngine;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
Expand All @@ -31,7 +31,7 @@
import org.apache.shardingsphere.mode.event.dispatch.metadata.schema.view.DropViewEvent;
import org.apache.shardingsphere.mode.lock.GlobalLockContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.lock.GlobalLockPersistService;
import org.apache.shardingsphere.mode.manager.cluster.persist.GlobalLockPersistService;
import org.apache.shardingsphere.mode.metadata.refresher.ShardingSphereStatisticsRefreshEngine;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch;
package org.apache.shardingsphere.mode.manager.cluster.event.dispatch.subscriber;

import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void registerStorageUnits(final String databaseName, final Map<String, Da
MetaDataContexts reloadMetaDataContexts = MetaDataContextsFactory.createBySwitchResource(databaseName, false,
switchingResource, originalMetaDataContexts, metaDataPersistService, metaDataContextManager.getComputeNodeInstanceContext());
metaDataPersistService.getDataSourceUnitService().persist(databaseName, toBeRegisteredProps);
afterStorageUnitsAltered(databaseName, originalMetaDataContexts, reloadMetaDataContexts);
afterStorageUnitsRegistered(databaseName, originalMetaDataContexts, reloadMetaDataContexts);
reloadMetaDataContexts.close();
} finally {
closeNewDataSources(newDataSources);
Expand Down Expand Up @@ -179,16 +179,20 @@ private Collection<String> getToBeDroppedResourceNames(final String databaseName
return toBeDroppedResourceNames.stream().filter(propsMap::containsKey).collect(Collectors.toList());
}

private void afterStorageUnitsAltered(final String databaseName, final MetaDataContexts originalMetaDataContexts, final MetaDataContexts reloadMetaDataContexts) {
reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getAllSchemas().forEach(each -> metaDataPersistService.getDatabaseMetaDataFacade()
.getSchema().alterByRuleAltered(reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getName(), each));
private void afterStorageUnitsRegistered(final String databaseName, final MetaDataContexts originalMetaDataContexts, final MetaDataContexts reloadMetaDataContexts) {
Optional.ofNullable(reloadMetaDataContexts.getStatistics().getDatabaseData().get(databaseName))
.ifPresent(optional -> optional.getSchemaData().forEach((schemaName, schemaData) -> metaDataPersistService.getShardingSphereDataPersistService()
.persist(originalMetaDataContexts.getMetaData().getDatabase(databaseName), schemaName, schemaData)));
metaDataPersistService.persistReloadDatabaseByAlter(databaseName, reloadMetaDataContexts.getMetaData().getDatabase(databaseName),
originalMetaDataContexts.getMetaData().getDatabase(databaseName));
}

private void afterStorageUnitsAltered(final String databaseName, final MetaDataContexts originalMetaDataContexts, final MetaDataContexts reloadMetaDataContexts) {
reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getAllSchemas().forEach(each -> metaDataPersistService.getDatabaseMetaDataFacade()
.getSchema().alterByRuleAltered(reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getName(), each));
afterStorageUnitsRegistered(databaseName, originalMetaDataContexts, reloadMetaDataContexts);
}

private void afterStorageUnitsDropped(final String databaseName, final MetaDataContexts originalMetaDataContexts, final MetaDataContexts reloadMetaDataContexts) {
reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getAllSchemas().forEach(each -> metaDataPersistService.getDatabaseMetaDataFacade()
.getSchema().alterByRuleDropped(reloadMetaDataContexts.getMetaData().getDatabase(databaseName).getName(), each));
Expand Down
Loading

0 comments on commit 0399ba4

Please sign in to comment.