Skip to content

Commit

Permalink
[ISSUE #8438] Fix broker return two messages when query message and i…
Browse files Browse the repository at this point in the history
…ndex service bug
  • Loading branch information
lizhimins committed Jul 24, 2024
1 parent 6e6319f commit 200e7ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ public synchronized void shutdown() {
if (flatFileStore != null) {
flatFileStore.shutdown();
}
if (indexService != null) {
indexService.shutdown();
}
if (storeExecutor != null) {
storeExecutor.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void recoverFileSize() {
public void initOffset(long offset) {
if (this.fileSegmentTable.isEmpty()) {
FileSegment fileSegment = fileSegmentFactory.createSegment(fileType, filePath, offset);
fileSegment.initPosition(fileSegment.getSize());
this.flushFileSegmentMeta(fileSegment);
this.fileSegmentTable.add(fileSegment);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,12 @@ protected CompletableFuture<List<IndexItem>> queryAsyncFromUnsealedFile(
buffer.position(this.getItemPosition(slotValue));
buffer.get(bytes);
IndexItem indexItem = new IndexItem(bytes);
long storeTimestamp = indexItem.getTimeDiff() + beginTimestamp.get();
if (hashCode == indexItem.getHashCode()) {
result.add(indexItem);
if (hashCode == indexItem.getHashCode() &&
beginTime <= storeTimestamp && storeTimestamp <= endTime) {
result.add(indexItem);
}
if (result.size() > maxCount) {
break;
}
Expand Down

0 comments on commit 200e7ed

Please sign in to comment.