diff --git a/.gitignore b/.gitignore
index 3f5f9f0f006e181044b1369cddbbe2863baf1bce..80c6f569862c2916f5fc8b11ed6d3690064e3938 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@ devenv
*.iml
.idea/
*.versionsBackup
-*bin
!NOTICE-BIN
!LICENSE-BIN
-.DS_Store
+.DS_Store
\ No newline at end of file
diff --git a/BUILDING b/BUILDING
index 1498b3e323c0fd60ef2f7c9eed12e7c0e5476281..8a304952b781e1d9114dfa3b2490ceba2df93866 100644
--- a/BUILDING
+++ b/BUILDING
@@ -1,37 +1,37 @@
-Build instructions for RocketMQ
+Build Instructions for Apache RocketMQ
====================================================
-(1) Requisites
+(1) Prerequisites
-JDK 1.7+ is required in order to compile and run RocketMQ.
+ JDK 1.7+ is required in order to compile and run RocketMQ.
-RocketMQ utilizes Maven as a distribution management and packaging tool. Version 3.0.3 or later is required.
-Maven installation and configuration instructions can be found here:
+ RocketMQ utilizes Maven as a distribution management and packaging tool. Version 3.0.3 or later is required.
+ Maven installation and configuration instructions can be found here:
-http://maven.apache.org/run-maven/index.html
+ http://maven.apache.org/run-maven/index.html
-(2) Executing test cases
+(2) Run test cases
-Execute the following command in order to compile and test the components:
+ Execute the following command in order to compile and run test cases of each components:
-$ mvn test
+ $ mvn test
-(3) Importing projects to eclipse
+(3) Import projects to Eclipse IDE
-First, generate eclipse project files:
+ First, generate eclipse project files:
-$ mvn -U eclipse:eclipse
+ $ mvn -U eclipse:eclipse
-Then, import to eclipse by specifying the root directory of the project via:
+ Then, import to eclipse by specifying the root directory of the project via:
-[File] > [Import] > [Existing Projects into Workspace].
+ [File] > [Import] > [Existing Projects into Workspace].
-(4) Building packages
+(4) Build distribution packages
-Execute the following command in order to build the tar.gz packages and install JAR to the local repository:
+ Execute the following command in order to build the tar.gz packages and install JAR into local repository:
-$ mvn clean install -Prelease-all assembly:assembly -U
\ No newline at end of file
+ $ mvn -Prelease-all -DskipTests clean package install -U
\ No newline at end of file
diff --git a/LICENSE-BIN b/distribution/LICENSE-BIN
similarity index 100%
rename from LICENSE-BIN
rename to distribution/LICENSE-BIN
diff --git a/NOTICE-BIN b/distribution/NOTICE-BIN
similarity index 100%
rename from NOTICE-BIN
rename to distribution/NOTICE-BIN
diff --git a/bin/README.md b/distribution/bin/README.md
similarity index 100%
rename from bin/README.md
rename to distribution/bin/README.md
diff --git a/bin/cachedog.sh b/distribution/bin/cachedog.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/cachedog.sh
rename to distribution/bin/cachedog.sh
diff --git a/bin/cleancache.sh b/distribution/bin/cleancache.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/cleancache.sh
rename to distribution/bin/cleancache.sh
diff --git a/bin/cleancache.v1.sh b/distribution/bin/cleancache.v1.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/cleancache.v1.sh
rename to distribution/bin/cleancache.v1.sh
diff --git a/bin/mqadmin b/distribution/bin/mqadmin
similarity index 100%
rename from bin/mqadmin
rename to distribution/bin/mqadmin
diff --git a/bin/mqadmin.cmd b/distribution/bin/mqadmin.cmd
similarity index 100%
rename from bin/mqadmin.cmd
rename to distribution/bin/mqadmin.cmd
diff --git a/bin/mqadmin.xml b/distribution/bin/mqadmin.xml
similarity index 100%
rename from bin/mqadmin.xml
rename to distribution/bin/mqadmin.xml
diff --git a/bin/mqbroker b/distribution/bin/mqbroker
similarity index 100%
rename from bin/mqbroker
rename to distribution/bin/mqbroker
diff --git a/bin/mqbroker.cmd b/distribution/bin/mqbroker.cmd
similarity index 100%
rename from bin/mqbroker.cmd
rename to distribution/bin/mqbroker.cmd
diff --git a/bin/mqbroker.numanode0 b/distribution/bin/mqbroker.numanode0
similarity index 100%
rename from bin/mqbroker.numanode0
rename to distribution/bin/mqbroker.numanode0
diff --git a/bin/mqbroker.numanode1 b/distribution/bin/mqbroker.numanode1
similarity index 100%
rename from bin/mqbroker.numanode1
rename to distribution/bin/mqbroker.numanode1
diff --git a/bin/mqbroker.numanode2 b/distribution/bin/mqbroker.numanode2
similarity index 100%
rename from bin/mqbroker.numanode2
rename to distribution/bin/mqbroker.numanode2
diff --git a/bin/mqbroker.numanode3 b/distribution/bin/mqbroker.numanode3
similarity index 100%
rename from bin/mqbroker.numanode3
rename to distribution/bin/mqbroker.numanode3
diff --git a/bin/mqbroker.xml b/distribution/bin/mqbroker.xml
similarity index 100%
rename from bin/mqbroker.xml
rename to distribution/bin/mqbroker.xml
diff --git a/bin/mqfiltersrv b/distribution/bin/mqfiltersrv
similarity index 100%
rename from bin/mqfiltersrv
rename to distribution/bin/mqfiltersrv
diff --git a/bin/mqfiltersrv.cmd b/distribution/bin/mqfiltersrv.cmd
similarity index 100%
rename from bin/mqfiltersrv.cmd
rename to distribution/bin/mqfiltersrv.cmd
diff --git a/bin/mqfiltersrv.xml b/distribution/bin/mqfiltersrv.xml
similarity index 100%
rename from bin/mqfiltersrv.xml
rename to distribution/bin/mqfiltersrv.xml
diff --git a/bin/mqnamesrv b/distribution/bin/mqnamesrv
similarity index 100%
rename from bin/mqnamesrv
rename to distribution/bin/mqnamesrv
diff --git a/bin/mqnamesrv.cmd b/distribution/bin/mqnamesrv.cmd
similarity index 100%
rename from bin/mqnamesrv.cmd
rename to distribution/bin/mqnamesrv.cmd
diff --git a/bin/mqnamesrv.xml b/distribution/bin/mqnamesrv.xml
similarity index 100%
rename from bin/mqnamesrv.xml
rename to distribution/bin/mqnamesrv.xml
diff --git a/bin/mqshutdown b/distribution/bin/mqshutdown
similarity index 100%
rename from bin/mqshutdown
rename to distribution/bin/mqshutdown
diff --git a/bin/mqshutdown.cmd b/distribution/bin/mqshutdown.cmd
similarity index 100%
rename from bin/mqshutdown.cmd
rename to distribution/bin/mqshutdown.cmd
diff --git a/bin/os.sh b/distribution/bin/os.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/os.sh
rename to distribution/bin/os.sh
diff --git a/bin/play.cmd b/distribution/bin/play.cmd
similarity index 100%
rename from bin/play.cmd
rename to distribution/bin/play.cmd
diff --git a/bin/play.sh b/distribution/bin/play.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/play.sh
rename to distribution/bin/play.sh
diff --git a/distribution/bin/runbroker b/distribution/bin/runbroker
new file mode 100644
index 0000000000000000000000000000000000000000..538f8e16b70a8d08cea5defa91ebbdd6878c868a
--- /dev/null
+++ b/distribution/bin/runbroker
@@ -0,0 +1,15 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
diff --git a/bin/runbroker.cmd b/distribution/bin/runbroker.cmd
similarity index 100%
rename from bin/runbroker.cmd
rename to distribution/bin/runbroker.cmd
diff --git a/bin/runbroker.sh b/distribution/bin/runbroker.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/runbroker.sh
rename to distribution/bin/runbroker.sh
diff --git a/bin/runserver.cmd b/distribution/bin/runserver.cmd
similarity index 100%
rename from bin/runserver.cmd
rename to distribution/bin/runserver.cmd
diff --git a/bin/runserver.sh b/distribution/bin/runserver.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/runserver.sh
rename to distribution/bin/runserver.sh
diff --git a/bin/setcache.sh b/distribution/bin/setcache.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/setcache.sh
rename to distribution/bin/setcache.sh
diff --git a/bin/startfsrv.sh b/distribution/bin/startfsrv.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/startfsrv.sh
rename to distribution/bin/startfsrv.sh
diff --git a/bin/tools.cmd b/distribution/bin/tools.cmd
similarity index 100%
rename from bin/tools.cmd
rename to distribution/bin/tools.cmd
diff --git a/bin/tools.sh b/distribution/bin/tools.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/tools.sh
rename to distribution/bin/tools.sh
diff --git a/conf/2m-2s-async/broker-a-s.properties b/distribution/conf/2m-2s-async/broker-a-s.properties
similarity index 100%
rename from conf/2m-2s-async/broker-a-s.properties
rename to distribution/conf/2m-2s-async/broker-a-s.properties
diff --git a/conf/2m-2s-async/broker-a.properties b/distribution/conf/2m-2s-async/broker-a.properties
similarity index 100%
rename from conf/2m-2s-async/broker-a.properties
rename to distribution/conf/2m-2s-async/broker-a.properties
diff --git a/conf/2m-2s-async/broker-b-s.properties b/distribution/conf/2m-2s-async/broker-b-s.properties
similarity index 100%
rename from conf/2m-2s-async/broker-b-s.properties
rename to distribution/conf/2m-2s-async/broker-b-s.properties
diff --git a/conf/2m-2s-async/broker-b.properties b/distribution/conf/2m-2s-async/broker-b.properties
similarity index 100%
rename from conf/2m-2s-async/broker-b.properties
rename to distribution/conf/2m-2s-async/broker-b.properties
diff --git a/conf/2m-2s-sync/broker-a-s.properties b/distribution/conf/2m-2s-sync/broker-a-s.properties
similarity index 100%
rename from conf/2m-2s-sync/broker-a-s.properties
rename to distribution/conf/2m-2s-sync/broker-a-s.properties
diff --git a/conf/2m-2s-sync/broker-a.properties b/distribution/conf/2m-2s-sync/broker-a.properties
similarity index 100%
rename from conf/2m-2s-sync/broker-a.properties
rename to distribution/conf/2m-2s-sync/broker-a.properties
diff --git a/conf/2m-2s-sync/broker-b-s.properties b/distribution/conf/2m-2s-sync/broker-b-s.properties
similarity index 100%
rename from conf/2m-2s-sync/broker-b-s.properties
rename to distribution/conf/2m-2s-sync/broker-b-s.properties
diff --git a/conf/2m-2s-sync/broker-b.properties b/distribution/conf/2m-2s-sync/broker-b.properties
similarity index 100%
rename from conf/2m-2s-sync/broker-b.properties
rename to distribution/conf/2m-2s-sync/broker-b.properties
diff --git a/conf/2m-noslave/broker-a.properties b/distribution/conf/2m-noslave/broker-a.properties
similarity index 100%
rename from conf/2m-noslave/broker-a.properties
rename to distribution/conf/2m-noslave/broker-a.properties
diff --git a/conf/2m-noslave/broker-b.properties b/distribution/conf/2m-noslave/broker-b.properties
similarity index 100%
rename from conf/2m-noslave/broker-b.properties
rename to distribution/conf/2m-noslave/broker-b.properties
diff --git a/conf/broker.conf b/distribution/conf/broker.conf
similarity index 100%
rename from conf/broker.conf
rename to distribution/conf/broker.conf
diff --git a/conf/logback_broker.xml b/distribution/conf/logback_broker.xml
similarity index 100%
rename from conf/logback_broker.xml
rename to distribution/conf/logback_broker.xml
diff --git a/conf/logback_filtersrv.xml b/distribution/conf/logback_filtersrv.xml
similarity index 100%
rename from conf/logback_filtersrv.xml
rename to distribution/conf/logback_filtersrv.xml
diff --git a/conf/logback_namesrv.xml b/distribution/conf/logback_namesrv.xml
similarity index 100%
rename from conf/logback_namesrv.xml
rename to distribution/conf/logback_namesrv.xml
diff --git a/conf/logback_tools.xml b/distribution/conf/logback_tools.xml
similarity index 100%
rename from conf/logback_tools.xml
rename to distribution/conf/logback_tools.xml
diff --git a/distribution/pom.xml b/distribution/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..41f36dc79fd7eed2ab7029269bbb04a168f89f4e
--- /dev/null
+++ b/distribution/pom.xml
@@ -0,0 +1,125 @@
+
+
+
+ 4.0.0
+
+ org.apache.rocketmq
+ rocketmq-all
+ 4.1.0-incubating-SNAPSHOT
+
+ rocketmq-distribution
+ rocketmq-distribution ${project.version}
+ pom
+
+
+
+
+ release-all
+
+
+
+ org.apache.rocketmq
+ rocketmq-broker
+
+
+
+ org.apache.rocketmq
+ rocketmq-client
+
+
+
+ org.apache.rocketmq
+ rocketmq-filtersrv
+
+
+
+ org.apache.rocketmq
+ rocketmq-tools
+
+
+
+ org.apache.rocketmq
+ rocketmq-example
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ release-all
+
+ single
+
+ package
+
+
+ release.xml
+
+ false
+
+
+
+
+
+ apache-rocketmq
+
+
+
+
+ release-client
+
+
+
+ org.apache.rocketmq
+ rocketmq-client
+ ${project.version}
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ release-client
+
+ single
+
+ package
+
+
+ release-client.xml
+
+ false
+
+
+
+
+
+ apache-rocketmq
+
+
+
+
+
\ No newline at end of file
diff --git a/release-client.xml b/distribution/release-client.xml
similarity index 87%
rename from release-client.xml
rename to distribution/release-client.xml
index 332f0de4d6f20c55638f15657405c0992e752d62..46563eb449c094919ab998641e41479ea2e88f40 100644
--- a/release-client.xml
+++ b/distribution/release-client.xml
@@ -15,7 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
client
false
@@ -23,14 +22,14 @@
dir
tar.gz
-
-
-
- DISCLAIMER
- README.md
-
-
-
+
+
+ ../
+
+ DISCLAIMER
+ README.md
+
+
@@ -45,6 +44,7 @@
+ true
org.apache.rocketmq:rocketmq-client
diff --git a/release.xml b/distribution/release.xml
similarity index 88%
rename from release.xml
rename to distribution/release.xml
index 1fdf8c998eb726d135a10593ddba7b57f03884b3..2d3ec1ecc23001052df8fcacde36f6828c841002 100644
--- a/release.xml
+++ b/distribution/release.xml
@@ -15,7 +15,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
all
false
@@ -25,14 +24,26 @@
+ ../
- bin/*
- conf/**
- benchmark/*
DISCLAIMER
README.md
+
+
+
+ conf/**
+ benchmark/*
+
+
+
+
+
+ bin/*
+
+ 0755
+
@@ -48,6 +59,7 @@
+ true
org.apache.rocketmq:rocketmq-broker
org.apache.rocketmq:rocketmq-tools
diff --git a/pom.xml b/pom.xml
index ce6a7f179171998bfc1fe28ef63c44426fc68366..47df84d42b5119a07a865549d1c47478a7641c85 100644
--- a/pom.xml
+++ b/pom.xml
@@ -179,6 +179,7 @@
filtersrv
srvutil
test
+ distribution
@@ -380,6 +381,14 @@
3.0.2
+
+
+
+ maven-assembly-plugin
+ 3.0.0
+
+
+
@@ -438,40 +447,6 @@
-
- release-all
-
-
-
- maven-assembly-plugin
- 2.6
-
- apache-rocketmq
-
- release.xml
-
-
-
-
-
-
-
- release-client
-
-
-
- maven-assembly-plugin
- 2.6
-
- apache-rocketmq
-
- release-client.xml
-
-
-
-
-
-
it-test
@@ -578,6 +553,11 @@
rocketmq-srvutil
${project.version}
+
+ ${project.groupId}
+ rocketmq-example
+ ${project.version}
+
org.slf4j
slf4j-api
diff --git a/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java b/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java
index eeb359808d1ca2f3890b273dcd67bc8f882a864d..919c6372ee9fdc054e78b408c1976c5a9d4e9825 100644
--- a/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java
+++ b/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java
@@ -130,9 +130,7 @@ public class ConsumeQueue {
MappedFile mappedFile = this.mappedFileQueue.getMappedFileByTime(timestamp);
if (mappedFile != null) {
long offset = 0;
- int low =
- minLogicOffset > mappedFile.getFileFromOffset() ? (int) (minLogicOffset - mappedFile
- .getFileFromOffset()) : 0;
+ int low = minLogicOffset > mappedFile.getFileFromOffset() ? (int) (minLogicOffset - mappedFile.getFileFromOffset()) : 0;
int high = 0;
int midOffset = -1, targetOffset = -1, leftOffset = -1, rightOffset = -1;
long leftIndexValue = -1L, rightIndexValue = -1L;
@@ -302,7 +300,6 @@ public class ConsumeQueue {
SelectMappedBufferResult result = mappedFile.selectMappedBuffer(0);
if (result != null) {
try {
-
for (int i = 0; i < result.getSize(); i += ConsumeQueue.CQ_STORE_UNIT_SIZE) {
long offsetPy = result.getByteBuffer().getLong();
result.getByteBuffer().getInt();
@@ -310,13 +307,13 @@ public class ConsumeQueue {
if (offsetPy >= phyMinOffset) {
this.minLogicOffset = result.getMappedFile().getFileFromOffset() + i;
- log.info("compute logics min offset: " + this.getMinOffsetInQueue() + ", topic: "
- + this.topic + ", queueId: " + this.queueId);
+ log.info("Compute logical min offset: {}, topic: {}, queueId: {}",
+ this.getMinOffsetInQueue(), this.topic, this.queueId);
break;
}
}
} catch (Exception e) {
- e.printStackTrace();
+ log.error("Exception thrown when correctMinOffset", e);
} finally {
result.release();
}
diff --git a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
index 5cb72ce2dd7fb6140edbf402bfafece408ef2247..550e578c21ccfebea7ffc8416d4f94a5c9107633 100644
--- a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
+++ b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
@@ -402,7 +402,7 @@ public class MappedFile extends ReferenceResource {
public boolean cleanup(final long currentRef) {
if (this.isAvailable()) {
log.error("this file[REF:" + currentRef + "] " + this.fileName
- + " have not shutdown, stop unmaping.");
+ + " have not shutdown, stop unmapping.");
return false;
}