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

2.19.09.0 1467 related bug fix #1502

Merged
merged 4 commits into from
Nov 15, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
#1467 rebuild the dataHost in reload even if the standby dataSource c…
…hanges
  • Loading branch information
sunsun314 committed Nov 15, 2019
commit b7ab8df03291812a0a89d81dad5c86100bd30d33
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,22 @@ private Set<PhysicalDatasourceDiff> createHostChangeSet(AbstractPhysicalDBPool n
for (int i = 0; i < newDbPool.getWriteSources().length; i++) {
PhysicalDatasource writeHost = newDbPool.getWriteSources()[i];
PhysicalDatasource[] readHost = newDbPool.getReadSources().get(i);
PhysicalDatasource[] standByHost = newDbPool.getStandbyReadSourcesMap().get(i);

PhysicalDatasource orgHost = null;
PhysicalDatasource[] relatedHost = null;
for (int j = 0; j < orgDbPool.getWriteSources().length; j++) {
PhysicalDatasource oldHost = orgDbPool.getWriteSources()[j];
PhysicalDatasource[] oldRHost = orgDbPool.getReadSources().get(j);
PhysicalDatasource[] oldStandByHost = orgDbPool.getStandbyReadSourcesMap().get(j);


if (oldHost.equals(writeHost) &&
((oldRHost == null && readHost == null) ||
((oldRHost != null && readHost != null) && oldRHost.length == readHost.length))) {
((oldRHost == null && readHost == null) || ((oldRHost != null && readHost != null) && oldRHost.length == readHost.length)) &&
((oldStandByHost == null && standByHost == null) || ((oldStandByHost != null && standByHost != null) && oldStandByHost.length == standByHost.length))) {
boolean sameFlag = true;

//compare the readHost is the same
if (oldRHost != null) {
for (int k = 0; k < oldRHost.length; k++) {
if (!oldRHost[k].equals(readHost[k])) {
Expand All @@ -78,6 +83,21 @@ private Set<PhysicalDatasourceDiff> createHostChangeSet(AbstractPhysicalDBPool n
}
}
}

//compare the sandByHost is the same
if (sameFlag && oldStandByHost != null) {
for (int k = 0; k < oldStandByHost.length; k++) {
if (!oldStandByHost[k].equals(standByHost[k])) {
sameFlag = false;
break;
} else {
oldStandByHost[k].setTestConnSuccess(standByHost[k].isTestConnSuccess());
}
}
}

//only when the writeHost is the same && readHost list is the same && standByHost is the same
// that means the two dataHost is the same
if (sameFlag) {
//update connection test result
oldHost.setTestConnSuccess(writeHost.isTestConnSuccess());
Expand All @@ -86,6 +106,7 @@ private Set<PhysicalDatasourceDiff> createHostChangeSet(AbstractPhysicalDBPool n
break;
}
}

}

if (orgHost != null) {
Expand Down