@vindex TMPDIR
All commands respect @env{$TMPDIR} environment variable.
+@vindex NNCPNOSYNC
+If you set @env{$NNCPNOSYNC=1}, then all @code{fsync} operations will be
+skipped. That is dangerous option, but if there there are abilities to
+rollback possibly corrupted state to some stable snapshot, then disabled
+@code{fsync} can give considerable increase in performance.
+
@menu
Configuration file commands
@node Новости
@section Новости
+@node Релиз 8.6.0
+@subsection Релиз 8.6.0
+@itemize
+
+@item
+Появилась возможность отключения @code{fsync} операции
+@env{$NNCPNOSYNC=1} переменной окружения.
+
+@item
+Добавлены разнообразные индексы в документации, что должно помочь при
+поиске в ней.
+
+@end itemize
+
@node Релиз 8.5.0
@subsection Релиз 8.5.0
@itemize
@itemize
@item
-Исправлено падение при fsync директорий после создания @file{.seen} файлов.
+Исправлено падение при @code{fsync} директорий после создания @file{.seen} файлов.
@end itemize
невозможности online аутентификации нод.
@item
-Явная синхронизация (fsync) директорий для гарантированного
+Явная синхронизация (@code{fsync}) директорий для гарантированного
переименования файлов.
@end itemize
See also this page @ref{Новости, on russian}.
+@node Release 8_6_0
+@section Release 8.6.0
+@itemize
+
+@item
+Ability to turn @code{fsync} operation off using @env{$NNCPNOSYNC=1}
+environment variable.
+
+@item
+Added various indices in documentation, that should help searching in it.
+
+@end itemize
+
@node Release 8_5_0
@section Release 8.5.0
@itemize
@itemize
@item
-Fixed failing directories fsync after @file{.seen} file creation.
+Fixed failing directories @code{fsync} after @file{.seen} file creation.
@end itemize
configuration files, that lead to inability to authenticate online peers.
@item
-Explicit directories fsync-ing for guaranteed files renaming.
+Explicit directories @code{fsync}-ing for guaranteed files renaming.
@end itemize
CfgPathEnv = "NNCPCFG"
CfgSpoolEnv = "NNCPSPOOL"
CfgLogEnv = "NNCPLOG"
+ CfgNoSync = "NNCPNOSYNC"
)
var (
if err = bufTmp.Flush(); err != nil {
log.Fatalln("Error during flushing:", err)
}
- if err = tmp.Sync(); err != nil {
- log.Fatalln("Error during syncing:", err)
+ if !nncp.NoSync {
+ if err = tmp.Sync(); err != nil {
+ log.Fatalln("Error during syncing:", err)
+ }
}
if err = tmp.Close(); err != nil {
log.Fatalln("Error during closing:", err)
log.Fatalln("Can not flush:", err)
}
if tmp != nil {
- if err = tmp.Sync(); err != nil {
- log.Fatalln("Can not sync:", err)
+ if !nncp.NoSync {
+ if err = tmp.Sync(); err != nil {
+ log.Fatalln("Can not sync:", err)
+ }
}
if err = tmp.Close(); err != nil {
log.Fatalln("Can not close:", err)
isBad = true
continue
}
- if err = tmp.Sync(); err != nil {
- tmp.Close()
- ctx.LogE("xfer-tx-sync", les, err, func(les nncp.LEs) string {
- return logMsg(les) + ": syncing"
- })
- isBad = true
- continue
+ if !nncp.NoSync {
+ if err = tmp.Sync(); err != nil {
+ tmp.Close()
+ ctx.LogE("xfer-tx-sync", les, err, func(les nncp.LEs) string {
+ return logMsg(les) + ": syncing"
+ })
+ isBad = true
+ continue
+ }
}
if err = tmp.Close(); err != nil {
ctx.LogE("xfer-tx-close", les, err, func(les nncp.LEs) string {
humanize.IBytes(uint64(fullsize)),
)
}
- err = fd.Sync()
- if err != nil {
- state.Ctx.LogE("sp-file-sync", lesp, err, func(les LEs) string {
- return logMsg(les) + ": syncing"
- })
- state.closeFd(filePathPart)
- continue
+ if !NoSync {
+ err = fd.Sync()
+ if err != nil {
+ state.Ctx.LogE("sp-file-sync", lesp, err, func(les LEs) string {
+ return logMsg(les) + ": syncing"
+ })
+ state.closeFd(filePathPart)
+ continue
+ }
}
if hasherAndOffset != nil {
delete(state.fileHashers, filePath)
"time"
)
+var NoSync bool
+
+func init() {
+ NoSync = os.Getenv(CfgNoSync) != ""
+}
+
func TempFile(dir, prefix string) (*os.File, error) {
// Assume that probability of suffix collision is negligible
suffix := strconv.FormatInt(time.Now().UnixNano()+int64(os.Getpid()), 16)
}
func DirSync(dirPath string) error {
+ if NoSync {
+ return nil
+ }
fd, err := os.Open(dirPath)
if err != nil {
return err
tmp.Fd.Close()
return err
}
- if err = tmp.Fd.Sync(); err != nil {
- tmp.Fd.Close()
- return err
+ if !NoSync {
+ if err = tmp.Fd.Sync(); err != nil {
+ tmp.Fd.Close()
+ return err
+ }
}
if err = tmp.Fd.Close(); err != nil {
return err
})
return err
}
- if err = tmp.Sync(); err != nil {
- tmp.Close()
- ctx.LogE("rx-sync", les, err, func(les LEs) string {
- return fmt.Sprintf(
- "Tossing file %s/%s (%s): %s: syncing",
- sender.Name, pktName,
- humanize.IBytes(pktSize), dst,
- )
- })
- return err
+ if !NoSync {
+ if err = tmp.Sync(); err != nil {
+ tmp.Close()
+ ctx.LogE("rx-sync", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing file %s/%s (%s): %s: syncing",
+ sender.Name, pktName,
+ humanize.IBytes(pktSize), dst,
+ )
+ })
+ return err
+ }
}
if err = tmp.Close(); err != nil {
ctx.LogE("rx-close", les, err, func(les LEs) string {