public long getStartOffsetByTimeStamp(long timestamp) {
        if (this.closed.get()) {
            throw new IllegalStateException(new StringBuilder(512)
                    .append("[Data Store] Closed MessageStore for storeKey ")
                    .append(this.storeKey).toString());
        }
        if (timestamp <= this.msgFileStore.getIndexMaxAppendTime()
                || !tubeConfig.isEnableMemStore()) {
            return this.msgFileStore.getStartOffsetByTimeStamp(timestamp);
        }
        this.writeCacheMutex.readLock().lock();
        try {
            // read from backup memory.
            if (timestamp <= this.msgMemStoreBeingFlush.getRightAppendTime()) {
                return this.msgMemStoreBeingFlush.getIndexStartWritePos();
            }
            // read from main memory.
            return this.msgMemStore.getIndexStartWritePos();
        } finally {
            this.writeCacheMutex.readLock().unlock();
        }
    }
Get start offset by timestamp.

@param timestamp  timestamp
@return start offset
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/broker/msgstore/MessageStore.java