[ISSUE #8438] Fix broker return two messages when query message and index service bug (#8439)

This commit is contained in:
lizhimins
2024-07-25 11:38:31 +08:00
committed by GitHub
parent 6e6319f11a
commit c080e6bbf2
3 changed files with 7 additions and 1 deletions
@@ -460,6 +460,9 @@ public class TieredMessageStore extends AbstractPluginMessageStore {
if (flatFileStore != null) {
flatFileStore.shutdown();
}
if (indexService != null) {
indexService.shutdown();
}
if (storeExecutor != null) {
storeExecutor.shutdown();
}
@@ -90,6 +90,7 @@ public class FlatAppendFile {
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);
}
@@ -287,7 +287,9 @@ public class IndexStoreFile implements IndexFile {
buffer.position(this.getItemPosition(slotValue));
buffer.get(bytes);
IndexItem indexItem = new IndexItem(bytes);
if (hashCode == indexItem.getHashCode()) {
long storeTimestamp = indexItem.getTimeDiff() + beginTimestamp.get();
if (hashCode == indexItem.getHashCode() &&
beginTime <= storeTimestamp && storeTimestamp <= endTime) {
result.add(indexItem);
if (result.size() > maxCount) {
break;