func (tb *table) CreateSnapshot(snapshotName string) (string, string, error) {
	logger.Infof("creating table snapshot of %q...", tb.path)
	startTime := time.Now()

	ptws := tb.GetPartitions(nil)
	defer tb.PutPartitions(ptws)

	dstSmallDir := fmt.Sprintf("%s/small/snapshots/%s", tb.path, snapshotName)
	if err := fs.MkdirAllFailIfExist(dstSmallDir); err != nil {
		return "", "", fmt.Errorf("cannot create dir %q: %s", dstSmallDir, err)
	}
	dstBigDir := fmt.Sprintf("%s/big/snapshots/%s", tb.path, snapshotName)
	if err := fs.MkdirAllFailIfExist(dstBigDir); err != nil {
		return "", "", fmt.Errorf("cannot create dir %q: %s", dstBigDir, err)
	}

	for _, ptw := range ptws {
		smallPath := dstSmallDir + "/" + ptw.pt.name
		bigPath := dstBigDir + "/" + ptw.pt.name
		if err := ptw.pt.CreateSnapshotAt(smallPath, bigPath); err != nil {
			return "", "", fmt.Errorf("cannot create snapshot for partition %q in %q: %s", ptw.pt.name, tb.path, err)
		}
	}

	fs.SyncPath(dstSmallDir)
	fs.SyncPath(dstBigDir)
	fs.SyncPath(filepath.Dir(dstSmallDir))
	fs.SyncPath(filepath.Dir(dstBigDir))

	logger.Infof("created table snapshot for %q at (%q, %q) in %s", tb.path, dstSmallDir, dstBigDir, time.Since(startTime))
	return dstSmallDir, dstBigDir, nil
}
// CreateSnapshot creates tb snapshot and returns paths to small and big parts of it.
CreateSnapshot creates tb snapshot and returns paths to small and big parts of it.
// CreateSnapshot creates tb snapshot and returns paths to small and big parts of it .
func (tb *table) CreateSnapshot(snapshotName string) (string, string, error) {
	logger.Infof("creating table snapshot of %q...", tb.path)
	startTime := time.Now()
	ptws := tb.GetPartitions(nil)
	defer tb.PutPartitions(ptws)
	dstSmallDir := fmt.Sprintf("%s/small/snapshots/%s", tb.path, snapshotName)
	if err := fs.MkdirAllFailIfExist(dstSmallDir); err != nil {
		return "", "", fmt.Errorf("cannot create dir %q: %s", dstSmallDir, err)
	}
	dstBigDir := fmt.Sprintf("%s/big/snapshots/%s", tb.path, snapshotName)
	if err := fs.MkdirAllFailIfExist(dstBigDir); err != nil {
		return "", "", fmt.Errorf("cannot create dir %q: %s", dstBigDir, err)
	}
	for _, ptw := range ptws {
		smallPath := dstSmallDir + "/" + ptw.pt.name
		bigPath := dstBigDir + "/" + ptw.pt.name
		if err := ptw.pt.CreateSnapshotAt(smallPath, bigPath); err != nil {
			return "", "", fmt.Errorf("cannot create snapshot for partition %q in %q: %s", ptw.pt.name, tb.path, err)
		}
	}
	fs.SyncPath(dstSmallDir)
	fs.SyncPath(dstBigDir)
	fs.SyncPath(filepath.Dir(dstSmallDir))
	fs.SyncPath(filepath.Dir(dstBigDir))
	logger.Infof("created table snapshot for %q at (%q, %q) in %s", tb.path, dstSmallDir, dstBigDir, time.Since(startTime))
	return dstSmallDir, dstBigDir, nil
}
func ( tb * table ) CreateSnapshot ( snapshotName string ) ( string , string , error ) { logger . Infof ( " " , tb . path ) startTime := time . Now ( ) ptws := tb . GetPartitions ( nil ) defer tb . PutPartitions ( ptws ) dstSmallDir := fmt . Sprintf ( " " , tb . path , snapshotName ) if err := fs . MkdirAllFailIfExist ( dstSmallDir ) ; err != nil { return " " , " " , fmt . Errorf ( " " , dstSmallDir , err ) } dstBigDir := fmt . Sprintf ( " " , tb . path , snapshotName ) if err := fs . MkdirAllFailIfExist ( dstBigDir ) ; err != nil { return " " , " " , fmt . Errorf ( " " , dstBigDir , err ) } for _ , ptw := range ptws { smallPath := dstSmallDir + " " + ptw . pt . name bigPath := dstBigDir + " " + ptw . pt . name if err := ptw . pt . CreateSnapshotAt ( smallPath , bigPath ) ; err != nil { return " " , " " , fmt . Errorf ( " " , ptw . pt . name , tb . path , err ) } } fs . SyncPath ( dstSmallDir ) fs . SyncPath ( dstBigDir ) fs . SyncPath ( filepath . Dir ( dstSmallDir ) ) fs . SyncPath ( filepath . Dir ( dstBigDir ) ) logger . Infof ( " " , tb . path , dstSmallDir , dstBigDir , time . Since ( startTime ) ) return dstSmallDir , dstBigDir , nil }
CreateSnapshot creates tb snapshot and returns paths to small and big parts of it.
CreateSnapshot creates tb snapshot and returns paths to small and big parts of it .