File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
store/src/main/java/org/apache/rocketmq/store/index/rocksdb Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -321,18 +321,18 @@ private void pollAndPutIndexRequest() {
321321 private void pollIndexRecord () {
322322 try {
323323 IndexRocksDBRecord firstReq = originIndexMsgQueue .poll (100 , TimeUnit .MILLISECONDS );
324- if (null != firstReq ) {
325- irs .add (firstReq );
326- while (true ) {
327- IndexRocksDBRecord tmpReq = originIndexMsgQueue .poll (100 , TimeUnit .MILLISECONDS );
328- if (null == tmpReq ) {
329- break ;
330- }
331- irs .add (tmpReq );
332- if (irs .size () >= BATCH_SIZE ) {
333- break ;
334- }
324+ if (firstReq == null ) {
325+ return ;
326+ }
327+ irs .add (firstReq );
328+ originIndexMsgQueue .drainTo (irs , BATCH_SIZE - irs .size ());
329+ while (irs .size () < BATCH_SIZE ) {
330+ IndexRocksDBRecord tmpReq = originIndexMsgQueue .poll (100 , TimeUnit .MILLISECONDS );
331+ if (tmpReq == null ) {
332+ break ;
335333 }
334+ irs .add (tmpReq );
335+ originIndexMsgQueue .drainTo (irs , BATCH_SIZE - irs .size ());
336336 }
337337 } catch (Exception e ) {
338338 logError .error ("IndexRocksDBStore IndexBuildService error: {}" , e .getMessage ());
You can’t perform that action at this time.
0 commit comments