File tree Expand file tree Collapse file tree
main/java/com/leansoft/bigqueue
java/com/leansoft/bigqueue Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,13 +227,13 @@ public void removeBefore(long timestamp) throws IOException {
227227 arrayWriteLock .lock ();
228228 long firstIndexPageIndex = this .indexPageFactory .getFirstPageIndexBefore (timestamp );
229229 if (firstIndexPageIndex >= 0 ) {
230- long nextIndexPageIndex = firstIndexPageIndex ;
231- if (nextIndexPageIndex == Long .MAX_VALUE ) { //wrap
232- nextIndexPageIndex = 0L ;
233- } else {
234- nextIndexPageIndex ++;
235- }
236- long toRemoveBeforeIndex = Calculator .mul (nextIndexPageIndex , INDEX_ITEMS_PER_PAGE_BITS );
230+ // long nextIndexPageIndex = firstIndexPageIndex;
231+ // if (nextIndexPageIndex == Long.MAX_VALUE) { //wrap
232+ // nextIndexPageIndex = 0L;
233+ // } else {
234+ // nextIndexPageIndex++;
235+ // }
236+ long toRemoveBeforeIndex = Calculator .mul (firstIndexPageIndex , INDEX_ITEMS_PER_PAGE_BITS );
237237 removeBeforeIndex (toRemoveBeforeIndex );
238238 }
239239 } catch (IndexOutOfBoundsException ex ) {
Original file line number Diff line number Diff line change @@ -186,9 +186,7 @@ public void deletePage(long index) throws IOException {
186186 }
187187 }
188188 if (deleted ) {
189- if (logger .isDebugEnabled ()) {
190- logger .debug ("Page file " + fileName + " was just deleted." );
191- }
189+ logger .info ("Page file " + fileName + " was just deleted." );
192190 } else {
193191 logger .warn ("fail to delete file " + fileName + " after max " + maxRound + " rounds of try, you may delete it manually." );
194192 }
Original file line number Diff line number Diff line change @@ -225,7 +225,15 @@ public void removeBeforeTest() throws IOException {
225225
226226 foQueue .removeBefore (timestamp );
227227
228- assertTrue (foQueue .size (fid ) == 1024 * 1024 );
228+ timestamp = System .currentTimeMillis ();
229+ String randomString3 = TestUtil .randomString (32 );
230+ for (int i = 0 ; i < 1024 * 1024 ; i ++) {
231+ foQueue .enqueue (randomString3 .getBytes ());
232+ }
233+
234+ foQueue .removeBefore (timestamp );
235+
236+ assertTrue (foQueue .size (fid ) == 2 * 1024 * 1024 );
229237 assertEquals (randomString2 , new String (foQueue .peek (fid )));
230238 }
231239
Original file line number Diff line number Diff line change 1212# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313# See the License for the specific language governing permissions and
1414# limitations under the License.
15- log4j.rootLogger =INFO ,stdout
15+ log4j.rootLogger =WARN ,stdout
1616
1717log4j.appender.stdout =org.apache.log4j.ConsoleAppender
1818log4j.appender.stdout.layout =org.apache.log4j.PatternLayout
19- log4j.appender.stdout.layout.ConversionPattern =[%d] %p %m (%C.java:%L)%n
20-
21- # log4j.logger.bigqueue.request.logger=DEBUG
22- log4j.logger.org.apache.zookeeper =WARN
23- log4j.logger.com.github.zkclient =WARN
24- # log4j.logger.com.leansoft.bigqueue.producer=DEBUG
25- # log4j.logger.com.leansoft.bigqueue.log.Log=DEBUG
26- # log4j.logger.com.leansoft.bigqueue=DEBUG
27- # log4j.logger.com.leansoft.bigqueue.log=DEBUG
28- # log4j.logger.com.leansoft.bigqueue.consumer.ZookeeperConsumerConnector=DEBUG
29- # log4j.logger.com.leansoft.bigqueue.producer.ProducerPool=DEBUG
19+ log4j.appender.stdout.layout.ConversionPattern =[%d] %p %m (%C.java:%L)%n
You can’t perform that action at this time.
0 commit comments