Documentation
¶
Index ¶
Constants ¶
const SeekThreshold = 1024 * 1024
Only enable seekLog when position range is more than SeekThreshold. The suggested value of SeekThreshold is the biggest log size.
const SlowLogQueryFileName = "tidb_slow_query.log"
Define the slow query file name
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IteratorWithPeek ¶
func New ¶
func New(fw *parser.FileWrapper, begin, end time.Time) (IteratorWithPeek, error)
Generate a new iterator from a specific file and a time range. The iterator should only return logs in the [begin, end] time range.
type LogIterator ¶
type LogIterator struct {
// contains filtered or unexported fields
}
LogIterator implements Iterator and IteratorWithPeek interface. It's used for reading logs from log files one by one by their time.
func (*LogIterator) Close ¶
func (iter *LogIterator) Close() error
The Close method close all resources the iterator has.
func (*LogIterator) Next ¶
func (iter *LogIterator) Next() (current item.Item, err error)
The Next method return next log and error (if any), and read disk for future logs. If any erros happened in Next(), the error will not be returned immediately, instead, the error will be deplayed to the next call of Next().
func (*LogIterator) Peek ¶
func (iter *LogIterator) Peek() item.Item
The Peek method returns next log, but don't change any state.
func (*LogIterator) Seek ¶
func (iter *LogIterator) Seek(point time.Time) error
Seek tries to find the first log entity whose time is after the param point, if not found, io.EOF will be returned.
params:
point: the start point of the logs
return:
if found, nil if not found, io.EOF otherwise, other error