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

1.0.0 rc3 #999

Merged
merged 51 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4956e20
Merge pull request #4 from alibaba/develop
yanlinly Nov 5, 2018
0133666
Fix #179
yanlinly Nov 5, 2018
30780f9
Merge pull request #5 from yanlinly/hotfix__namespace
yanlinly Nov 5, 2018
233272a
Merge remote-tracking branch 'nacos/develop'
yanlinly Nov 6, 2018
2f41248
Merge pull request #1 from alibaba/master
jifengnan Jan 13, 2019
abbdbab
Merge pull request #2 from alibaba/master
jifengnan Jan 31, 2019
05c3881
Merge pull request #4 from alibaba/master
jifengnan Mar 12, 2019
df7278a
#502 Fix url too long problem.
nkorange Mar 17, 2019
a902194
Close #910
nkorange Mar 18, 2019
7ec7311
Close #911
nkorange Mar 18, 2019
3f2d704
Fix #923
nkorange Mar 18, 2019
52d4e01
#502 Fix several bugs
nkorange Mar 18, 2019
f6ea504
#502 Refactor
nkorange Mar 19, 2019
7303ea7
#745 Remove server mode
nkorange Mar 20, 2019
cf8a3c7
Merge pull request #959 from alibaba/hotfix_client_beat
Mar 25, 2019
a745423
Merge branch 'develop' into feature_naming_group
nkorange Mar 25, 2019
e2a7206
Fix #961
nkorange Mar 26, 2019
14ecd9c
#502 Fix data inconsistent bug
nkorange Mar 26, 2019
8ff3b60
Add User-Agent header in access log
nkorange Mar 26, 2019
074d243
Merge branch 'master' into develop
yanlinly Mar 27, 2019
06df9ab
Merge pull request #6 from alibaba/develop
yanlinly Mar 27, 2019
d11fd7f
support aliyun ram role
yanlinly Mar 27, 2019
020350b
Merge pull request #964 from yanlinly/master
hxy1991 Mar 27, 2019
9500939
Merge pull request #5 from alibaba/master
jifengnan Mar 27, 2019
bb27800
#502 Fix remove service failed bug
nkorange Mar 27, 2019
37b9004
Fix #973
nkorange Mar 29, 2019
4c5b06c
Optimize code
nkorange Mar 29, 2019
9b7d613
update versionUtils in stream close
xuechaos Mar 29, 2019
1f125c4
Fix the issue: ArrayIndexOutOfBoundsException may be thrown when invo…
jifengnan Mar 29, 2019
180f3a7
Add unit test cases
jifengnan Mar 29, 2019
b1790fa
Merge pull request #975 from jifengnan/issue_974
Apr 1, 2019
7277680
适配测试用例
alios-studio Apr 1, 2019
2c7daa6
Fix #948
nkorange Apr 1, 2019
4dde5d6
Merge remote-tracking branch 'origin/feature_naming_group' into featu…
nkorange Apr 1, 2019
df4f338
Fixes #984
hxy1991 Apr 1, 2019
12c032c
#502 Fix raft publish bug
nkorange Apr 1, 2019
9c90502
Fixes #986
hxy1991 Apr 1, 2019
51dd3db
#502 Fix client beat bug
nkorange Apr 1, 2019
adcc955
Merge pull request #985 from hxy1991/fix_984
hxy1991 Apr 1, 2019
178b80e
del warnings spotbugs-annotations #981
xuechaos Apr 1, 2019
0b6246e
remove lgpl dependency
yanlinly Apr 1, 2019
ec8046e
Merge pull request #991 from yanlinly/master
xuechaos Apr 1, 2019
acaee3f
Merge pull request #993 from alibaba/del_warnings
yanlinly Apr 2, 2019
d8b768b
#502 Check if key blank before instantiate new list.
nkorange Apr 2, 2019
210af39
#502 Update switch name
nkorange Apr 2, 2019
e0547c8
Merge pull request #997 from alibaba/feature_naming_group
Apr 2, 2019
2fe8a76
Fix console 401 error
nkorange Apr 2, 2019
8e20fd6
Merge pull request #987 from hxy1991/fix_986
Apr 3, 2019
73d13b5
fix typo 控件 => 空间
neatlife Mar 30, 2019
4dc4031
Update version to 1.0.0-RC3
nkorange Apr 3, 2019
2cb96d1
#923 Recognize 'cluster'
nkorange Apr 3, 2019
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
#502 Refactor
  • Loading branch information
nkorange committed Mar 19, 2019
commit f6ea5042c84f29e94cbf557763b59daf9eb2818a
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import com.alibaba.fastjson.TypeReference;
import com.alibaba.nacos.naming.boot.RunningConfig;
import com.alibaba.nacos.naming.consistency.ApplyAction;
import com.alibaba.nacos.naming.consistency.RecordListener;
import com.alibaba.nacos.naming.consistency.Datum;
import com.alibaba.nacos.naming.consistency.KeyBuilder;
import com.alibaba.nacos.naming.consistency.RecordListener;
import com.alibaba.nacos.naming.core.Instances;
import com.alibaba.nacos.naming.core.Service;
import com.alibaba.nacos.naming.misc.*;
Expand Down Expand Up @@ -312,7 +312,7 @@ public void onPublish(Datum datum, RaftPeer source) throws Exception {
}
raftStore.updateTerm(local.term.get());

notifier.addTask(datum, ApplyAction.CHANGE);
notifier.addTask(datum.key, ApplyAction.CHANGE);

Loggers.RAFT.info("data added/updated, key={}, term={}", datum.key, local.term);
}
Expand Down Expand Up @@ -699,7 +699,7 @@ public Integer onCompleted(Response response) throws Exception {
}

datums.put(datum.key, datum);
notifier.addTask(datum, ApplyAction.CHANGE);
notifier.addTask(datum.key, ApplyAction.CHANGE);

local.resetLeaderDue();

Expand Down Expand Up @@ -844,7 +844,7 @@ public int datumSize() {

public void addDatum(Datum datum) {
datums.put(datum.key, datum);
notifier.addTask(datum, ApplyAction.CHANGE);
notifier.addTask(datum.key, ApplyAction.CHANGE);
}

public void loadDatum(String key) {
Expand All @@ -861,19 +861,17 @@ public void loadDatum(String key) {
}

private void deleteDatum(String key) {

Datum deleted = null;
Datum deleted;
try {
deleted = datums.remove(URLDecoder.decode(key, "UTF-8"));
if (deleted != null) {
raftStore.delete(deleted);
Loggers.RAFT.info("datum deleted, key: {}", key);
}
notifier.addTask(URLDecoder.decode(key, "UTF-8"), ApplyAction.DELETE);
} catch (UnsupportedEncodingException e) {
Loggers.RAFT.warn("datum key decode failed: {}", key);
}
// FIXME should we ignore the value of 'deleted'?
if (deleted != null) {
raftStore.delete(deleted);
notifier.addTask(deleted, ApplyAction.DELETE);
Loggers.RAFT.info("datum deleted, key: {}", key);
}
}

public boolean isInitialized() {
Expand All @@ -886,15 +884,15 @@ public class Notifier implements Runnable {

private BlockingQueue<Pair> tasks = new LinkedBlockingQueue<Pair>(1024 * 1024);

public void addTask(Datum datum, ApplyAction action) {
public void addTask(String datumKey, ApplyAction action) {

if (services.containsKey(datum.key) && action == ApplyAction.CHANGE) {
if (services.containsKey(datumKey) && action == ApplyAction.CHANGE) {
return;
}
if (action == ApplyAction.CHANGE) {
services.put(datum.key, StringUtils.EMPTY);
services.put(datumKey, StringUtils.EMPTY);
}
tasks.add(Pair.with(datum, action));
tasks.add(Pair.with(datumKey, action));
}

public int getTaskSize() {
Expand All @@ -914,58 +912,58 @@ public void run() {
continue;
}

Datum datum = (Datum) pair.getValue0();
String datumKey = (String) pair.getValue0();
ApplyAction action = (ApplyAction) pair.getValue1();

services.remove(datum.key);
services.remove(datumKey);

int count = 0;

if (listeners.containsKey(KeyBuilder.SERVICE_META_KEY_PREFIX)) {

if (KeyBuilder.matchServiceMetaKey(datum.key) && !KeyBuilder.matchSwitchKey(datum.key)) {
if (KeyBuilder.matchServiceMetaKey(datumKey) && !KeyBuilder.matchSwitchKey(datumKey)) {

for (RecordListener listener : listeners.get(KeyBuilder.SERVICE_META_KEY_PREFIX)) {
try {
if (action == ApplyAction.CHANGE) {
listener.onChange(datum.key, getDatum(datum.key).value);
listener.onChange(datumKey, getDatum(datumKey).value);
}

if (action == ApplyAction.DELETE) {
listener.onDelete(datum.key);
listener.onDelete(datumKey);
}
} catch (Throwable e) {
Loggers.RAFT.error("[NACOS-RAFT] error while notifying listener of key: {} {}", datum.key, e);
Loggers.RAFT.error("[NACOS-RAFT] error while notifying listener of key: {} {}", datumKey, e);
}
}
}
}

if (!listeners.containsKey(datum.key)) {
if (!listeners.containsKey(datumKey)) {
continue;
}

for (RecordListener listener : listeners.get(datum.key)) {
for (RecordListener listener : listeners.get(datumKey)) {

count++;

try {
if (action == ApplyAction.CHANGE) {
listener.onChange(datum.key, getDatum(datum.key).value);
listener.onChange(datumKey, getDatum(datumKey).value);
continue;
}

if (action == ApplyAction.DELETE) {
listener.onDelete(datum.key);
listener.onDelete(datumKey);
continue;
}
} catch (Throwable e) {
Loggers.RAFT.error("[NACOS-RAFT] error while notifying listener of key: {} {}", datum.key, e);
Loggers.RAFT.error("[NACOS-RAFT] error while notifying listener of key: {} {}", datumKey, e);
}
}

if (Loggers.RAFT.isDebugEnabled()) {
Loggers.RAFT.debug("[NACOS-RAFT] datum change notified, key: {}, listener count: {}", datum.key, count);
Loggers.RAFT.debug("[NACOS-RAFT] datum change notified, key: {}, listener count: {}", datumKey, count);
}
} catch (Throwable e) {
Loggers.RAFT.error("[NACOS-RAFT] Error while handling notifying task", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public synchronized ConcurrentHashMap<String, Datum> loadDatums(RaftCore.Notifie
datum = readDatum(datumFile, cache.getName());
if (datum != null) {
datums.put(datum.key, datum);
notifier.addTask(datum, ApplyAction.CHANGE);
notifier.addTask(datum.key, ApplyAction.CHANGE);
}
}
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ public String remove(HttpServletRequest request) throws Exception {
Constants.DEFAULT_NAMESPACE_ID);
String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME);

Service service = serviceManager.getService(namespaceId, serviceName);
if (service == null) {
throw new IllegalArgumentException("specified service not exist, serviceName : " + serviceName);
}

if (!service.allIPs().isEmpty()) {
throw new IllegalArgumentException("specified service has instances, serviceName : " + serviceName);
}

serviceManager.easyRemoveService(namespaceId, serviceName);

return "ok";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,16 @@ public int getResponsibleInstanceCount() {
}

public void easyRemoveService(String namespaceId, String serviceName) throws Exception {

Service service = getService(namespaceId, serviceName);
if (service == null) {
throw new IllegalArgumentException("specified service not exist, serviceName : " + serviceName);
}

if (!service.allIPs().isEmpty()) {
throw new IllegalArgumentException("specified service has instances, serviceName : " + serviceName);
}

consistencyService.remove(KeyBuilder.buildServiceMetaKey(namespaceId, serviceName));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
try {
String path = new URI(req.getRequestURI()).getPath();
if (ServerMode.AP.name().equals(switchDomain.getServerMode()) && !HttpMethod.GET.equals(req.getMethod())) {
if (path.startsWith(UtilsAndCommons.NACOS_NAMING_CONTEXT + UtilsAndCommons.NACOS_NAMING_SERVICE_CONTEXT)
|| path.startsWith(UtilsAndCommons.NACOS_NAMING_CONTEXT + UtilsAndCommons.NACOS_NAMING_CLUSTER_CONTEXT)) {
if (path.contains(UtilsAndCommons.NACOS_NAMING_CONTEXT + UtilsAndCommons.NACOS_NAMING_SERVICE_CONTEXT)
|| path.contains(UtilsAndCommons.NACOS_NAMING_CONTEXT + UtilsAndCommons.NACOS_NAMING_CLUSTER_CONTEXT)) {
resp.getWriter().write("server in AP mode, request: " + req.getMethod() + " " + path + " not permitted");
resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
Expand Down