func (tb *Table) MustClose() {
	close(tb.stopCh)

	logger.Infof("waiting for raw items flusher to stop on %q...", tb.path)
	startTime := time.Now()
	tb.rawItemsFlusherWG.Wait()
	logger.Infof("raw items flusher stopped in %s on %q", time.Since(startTime), tb.path)

	logger.Infof("waiting for part mergers to stop on %q...", tb.path)
	startTime = time.Now()
	tb.partMergersWG.Wait()
	logger.Infof("part mergers stopped in %s on %q", time.Since(startTime), tb.path)

	logger.Infof("flushing inmemory parts to files on %q...", tb.path)
	startTime = time.Now()

	// Flush raw items the last time before exit.
	tb.flushRawItems(true)

	// Flush inmemory parts to disk.
	var pws []*partWrapper
	tb.partsLock.Lock()
	for _, pw := range tb.parts {
		if pw.mp == nil {
			continue
		}
		if pw.isInMerge {
			logger.Panicf("BUG: the inmemory part %s mustn't be in merge after stopping parts merger in %q", &pw.mp.ph, tb.path)
		}
		pw.isInMerge = true
		pws = append(pws, pw)
	}
	tb.partsLock.Unlock()

	if err := tb.mergePartsOptimal(pws); err != nil {
		logger.Panicf("FATAL: cannot flush inmemory parts to files in %q: %s", tb.path, err)
	}
	logger.Infof("%d inmemory parts have been flushed to files in %s on %q", len(pws), time.Since(startTime), tb.path)

	// Remove references to parts from the tb, so they may be eventually closed
	// after all the seraches are done.
	tb.partsLock.Lock()
	parts := tb.parts
	tb.parts = nil
	tb.partsLock.Unlock()

	for _, pw := range parts {
		pw.decRef()
	}

	// Release flockF
	if err := tb.flockF.Close(); err != nil {
		logger.Panicf("FATAL:cannot close %q: %s", tb.flockF.Name(), err)
	}
}
// MustClose closes the table.
MustClose closes the table.
// MustClose closes the table .
func (tb *Table) MustClose() {
	close(tb.stopCh)
	logger.Infof("waiting for raw items flusher to stop on %q...", tb.path)
	startTime := time.Now()
	tb.rawItemsFlusherWG.Wait()
	logger.Infof("raw items flusher stopped in %s on %q", time.Since(startTime), tb.path)
	logger.Infof("waiting for part mergers to stop on %q...", tb.path)
	startTime = time.Now()
	tb.partMergersWG.Wait()
	logger.Infof("part mergers stopped in %s on %q", time.Since(startTime), tb.path)
	logger.Infof("flushing inmemory parts to files on %q...", tb.path)
	startTime = time.Now()
	tb.flushRawItems(true)
	var pws []*partWrapper
	tb.partsLock.Lock()
	for _, pw := range tb.parts {
		if pw.mp == nil {
			continue
		}
		if pw.isInMerge {
			logger.Panicf("BUG: the inmemory part %s mustn't be in merge after stopping parts merger in %q", &pw.mp.ph, tb.path)
		}
		pw.isInMerge = true
		pws = append(pws, pw)
	}
	tb.partsLock.Unlock()
	if err := tb.mergePartsOptimal(pws); err != nil {
		logger.Panicf("FATAL: cannot flush inmemory parts to files in %q: %s", tb.path, err)
	}
	logger.Infof("%d inmemory parts have been flushed to files in %s on %q", len(pws), time.Since(startTime), tb.path)
	tb.partsLock.Lock()
	parts := tb.parts
	tb.parts = nil
	tb.partsLock.Unlock()
	for _, pw := range parts {
		pw.decRef()
	}
	if err := tb.flockF.Close(); err != nil {
		logger.Panicf("FATAL:cannot close %q: %s", tb.flockF.Name(), err)
	}
}
func ( tb * Table ) MustClose ( ) { close ( tb . stopCh ) logger . Infof ( " " , tb . path ) startTime := time . Now ( ) tb . rawItemsFlusherWG . Wait ( ) logger . Infof ( " " , time . Since ( startTime ) , tb . path ) logger . Infof ( " " , tb . path ) startTime = time . Now ( ) tb . partMergersWG . Wait ( ) logger . Infof ( " " , time . Since ( startTime ) , tb . path ) logger . Infof ( " " , tb . path ) startTime = time . Now ( ) tb . flushRawItems ( true ) var pws [ ] * partWrapper tb . partsLock . Lock ( ) for _ , pw := range tb . parts { if pw . mp == nil { continue } if pw . isInMerge { logger . Panicf ( " " , & pw . mp . ph , tb . path ) } pw . isInMerge = true pws = append ( pws , pw ) } tb . partsLock . Unlock ( ) if err := tb . mergePartsOptimal ( pws ) ; err != nil { logger . Panicf ( " " , tb . path , err ) } logger . Infof ( " " , len ( pws ) , time . Since ( startTime ) , tb . path ) tb . partsLock . Lock ( ) parts := tb . parts tb . parts = nil tb . partsLock . Unlock ( ) for _ , pw := range parts { pw . decRef ( ) } if err := tb . flockF . Close ( ) ; err != nil { logger . Panicf ( " " , tb . flockF . Name ( ) , err ) } }
MustClose closes the table.
MustClose closes the table .
// Flush raw items the last time before exit. // Flush inmemory parts to disk. // Remove references to parts from the tb, so they may be eventually closed // after all the seraches are done. // Release flockF