This commit is contained in:
Chris Lu
2021-09-01 02:45:42 -07:00
parent d1a4e19a3f
commit 7ce97b59d8
45 changed files with 79 additions and 56 deletions

View File

@@ -154,7 +154,7 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
os.Exit(0) os.Exit(0)
} }
} }
if message.NewEntry.Name == remoteStorage.Name + filer.REMOTE_STORAGE_CONF_SUFFIX { if message.NewEntry.Name == remoteStorage.Name+filer.REMOTE_STORAGE_CONF_SUFFIX {
conf := &remote_pb.RemoteConf{} conf := &remote_pb.RemoteConf{}
if err := proto.Unmarshal(message.NewEntry.Content, conf); err != nil { if err := proto.Unmarshal(message.NewEntry.Content, conf); err != nil {
return fmt.Errorf("unmarshal %s/%s: %v", filer.DirectoryEtcRemote, message.NewEntry.Name, err) return fmt.Errorf("unmarshal %s/%s: %v", filer.DirectoryEtcRemote, message.NewEntry.Name, err)

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows // +build !windows
package command package command

View File

@@ -1,6 +1,5 @@
// +build !linux //go:build !linux && !darwin && !freebsd
// +build !darwin // +build !linux,!darwin,!freebsd
// +build !freebsd
package command package command

View File

@@ -1,3 +1,4 @@
//go:build linux || darwin || freebsd
// +build linux darwin freebsd // +build linux darwin freebsd
package command package command

View File

@@ -21,7 +21,7 @@ func MapFullPathToRemoteStorageLocation(localMountedDir util.FullPath, remoteMou
return remoteLocation return remoteLocation
} }
func MapRemoteStorageLocationPathToFullPath(localMountedDir util.FullPath, remoteMountedLocation *remote_pb.RemoteStorageLocation, remoteLocationPath string)(fp util.FullPath) { func MapRemoteStorageLocationPathToFullPath(localMountedDir util.FullPath, remoteMountedLocation *remote_pb.RemoteStorageLocation, remoteLocationPath string) (fp util.FullPath) {
return localMountedDir.Child(remoteLocationPath[len(remoteMountedLocation.Path):]) return localMountedDir.Child(remoteLocationPath[len(remoteMountedLocation.Path):])
} }

View File

@@ -1,3 +1,4 @@
//go:build linux || darwin || windows
// +build linux darwin windows // +build linux darwin windows
// limited GOOS due to modernc.org/libc/unistd // limited GOOS due to modernc.org/libc/unistd

View File

@@ -1,3 +1,4 @@
//go:build !linux && !darwin && !windows && !s390 && !ppc64le && !mips64
// +build !linux,!darwin,!windows,!s390,!ppc64le,!mips64 // +build !linux,!darwin,!windows,!s390,!ppc64le,!mips64
// limited GOOS due to modernc.org/libc/unistd // limited GOOS due to modernc.org/libc/unistd

View File

@@ -206,7 +206,7 @@ func (c *ChunkStreamReader) doRead(p []byte) (n int, err error) {
} }
func (c *ChunkStreamReader) isBufferEmpty() bool { func (c *ChunkStreamReader) isBufferEmpty() bool {
return len(c.buffer) <= int(c.logicOffset - c.bufferOffset) return len(c.buffer) <= int(c.logicOffset-c.bufferOffset)
} }
func (c *ChunkStreamReader) Seek(offset int64, whence int) (int64, error) { func (c *ChunkStreamReader) Seek(offset int64, whence int) (int64, error) {
@@ -261,7 +261,7 @@ func (c *ChunkStreamReader) prepareBufferFor(offset int64) (err error) {
} else if currentChunkIndex > 0 { } else if currentChunkIndex > 0 {
if insideChunk(offset, c.chunkViews[currentChunkIndex]) { if insideChunk(offset, c.chunkViews[currentChunkIndex]) {
// good hit // good hit
} else if insideChunk(offset, c.chunkViews[currentChunkIndex-1]){ } else if insideChunk(offset, c.chunkViews[currentChunkIndex-1]) {
currentChunkIndex -= 1 currentChunkIndex -= 1
// fmt.Printf("select -1 chunk %d %s\n", currentChunkIndex, c.chunkViews[currentChunkIndex].FileId) // fmt.Printf("select -1 chunk %d %s\n", currentChunkIndex, c.chunkViews[currentChunkIndex].FileId)
} else { } else {

View File

@@ -1,3 +1,4 @@
//go:build tikv
// +build tikv // +build tikv
package tikv package tikv

View File

@@ -1,3 +1,4 @@
//go:build tikv
// +build tikv // +build tikv
package tikv package tikv

View File

@@ -45,7 +45,7 @@ func TraverseBfs(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn
} }
func processOneDirectory(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn VisitFunc, dirQueue *util.Queue, dirQueueWg *sync.WaitGroup) (error) { func processOneDirectory(listDirFn ListDirectoryFunc, parentPath util.FullPath, visitFn VisitFunc, dirQueue *util.Queue, dirQueueWg *sync.WaitGroup) error {
return listDirFn(parentPath, func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error { return listDirFn(parentPath, func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error {
if err := visitFn(dir, name, isDirectory, remoteEntry); err != nil { if err := visitFn(dir, name, isDirectory, remoteEntry); err != nil {

View File

@@ -203,7 +203,7 @@ func (fs *FilerServer) eachEventNotificationFn(req *filer_pb.SubscribeMetadataRe
if hasPrefixIn(fullpath, req.PathPrefixes) { if hasPrefixIn(fullpath, req.PathPrefixes) {
// good // good
}else { } else {
if !strings.HasPrefix(fullpath, req.PathPrefix) { if !strings.HasPrefix(fullpath, req.PathPrefix) {
if eventNotification.NewParentPath != "" { if eventNotification.NewParentPath != "" {
newFullPath := util.Join(eventNotification.NewParentPath, entryName) newFullPath := util.Join(eventNotification.NewParentPath, entryName)

View File

@@ -1,3 +1,4 @@
//go:build rocksdb
// +build rocksdb // +build rocksdb
package weed_server package weed_server

View File

@@ -84,21 +84,21 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
return err return err
} }
if modifiedTsNs > 0 { if modifiedTsNs > 0 {
os.Chtimes(dataBaseFileName + ".dat", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs)) os.Chtimes(dataBaseFileName+".dat", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs))
} }
if modifiedTsNs, err = vs.doCopyFile(client, false, req.Collection, req.VolumeId, volFileInfoResp.CompactionRevision, volFileInfoResp.IdxFileSize, indexBaseFileName, ".idx", false, false); err != nil { if modifiedTsNs, err = vs.doCopyFile(client, false, req.Collection, req.VolumeId, volFileInfoResp.CompactionRevision, volFileInfoResp.IdxFileSize, indexBaseFileName, ".idx", false, false); err != nil {
return err return err
} }
if modifiedTsNs > 0 { if modifiedTsNs > 0 {
os.Chtimes(indexBaseFileName + ".idx", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs)) os.Chtimes(indexBaseFileName+".idx", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs))
} }
if modifiedTsNs, err = vs.doCopyFile(client, false, req.Collection, req.VolumeId, volFileInfoResp.CompactionRevision, volFileInfoResp.DatFileSize, dataBaseFileName, ".vif", false, true); err != nil { if modifiedTsNs, err = vs.doCopyFile(client, false, req.Collection, req.VolumeId, volFileInfoResp.CompactionRevision, volFileInfoResp.DatFileSize, dataBaseFileName, ".vif", false, true); err != nil {
return err return err
} }
if modifiedTsNs > 0 { if modifiedTsNs > 0 {
os.Chtimes(dataBaseFileName + ".vif", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs)) os.Chtimes(dataBaseFileName+".vif", time.Unix(0, modifiedTsNs), time.Unix(0, modifiedTsNs))
} }
os.Remove(dataBaseFileName + ".note") os.Remove(dataBaseFileName + ".note")
@@ -167,7 +167,7 @@ func (vs *VolumeServer) doCopyFile(client volume_server_pb.VolumeServerClient, i
only check the the differ of the file size only check the the differ of the file size
todo: maybe should check the received count and deleted count of the volume todo: maybe should check the received count and deleted count of the volume
*/ */
func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) (error) { func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) error {
stat, err := os.Stat(idxFileName) stat, err := os.Stat(idxFileName)
if err != nil { if err != nil {
return fmt.Errorf("stat idx file %s failed: %v", idxFileName, err) return fmt.Errorf("stat idx file %s failed: %v", idxFileName, err)

View File

@@ -59,7 +59,7 @@ func (c *commandRemoteCache) Do(args []string, commandEnv *CommandEnv, writer io
} }
mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir) mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir)
if detectErr != nil{ if detectErr != nil {
jsonPrintln(writer, mappings) jsonPrintln(writer, mappings)
return detectErr return detectErr
} }

View File

@@ -116,7 +116,6 @@ Namenode running as service 'hdfs' with FQDN 'namenode.hadoop.docker'.
`) `)
remoteConfigureCommand.StringVar(&conf.HdfsDataTransferProtection, "hdfs.dataTransferProtection", "", "[authentication|integrity|privacy] Kerberos data transfer protection") remoteConfigureCommand.StringVar(&conf.HdfsDataTransferProtection, "hdfs.dataTransferProtection", "", "[authentication|integrity|privacy] Kerberos data transfer protection")
if err = remoteConfigureCommand.Parse(args); err != nil { if err = remoteConfigureCommand.Parse(args); err != nil {
return nil return nil
} }

View File

@@ -1,3 +1,4 @@
//go:build openbsd || netbsd || plan9 || solaris
// +build openbsd netbsd plan9 solaris // +build openbsd netbsd plan9 solaris
package stats package stats

View File

@@ -1,3 +1,4 @@
//go:build !windows && !openbsd && !netbsd && !plan9 && !solaris
// +build !windows,!openbsd,!netbsd,!plan9,!solaris // +build !windows,!openbsd,!netbsd,!plan9,!solaris
package stats package stats

View File

@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux // +build !linux
package stats package stats

View File

@@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package stats package stats

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows // +build !windows
package memory_map package memory_map

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows // +build windows
package memory_map package memory_map

View File

@@ -1,3 +1,4 @@
//go:build !linux && !windows
// +build !linux,!windows // +build !linux,!windows
package backend package backend

View File

@@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package backend package backend

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows // +build windows
package backend package backend

View File

@@ -1,3 +1,4 @@
//go:build 5BytesOffset
// +build 5BytesOffset // +build 5BytesOffset
package needle_map package needle_map

View File

@@ -1,3 +1,4 @@
//go:build !5BytesOffset
// +build !5BytesOffset // +build !5BytesOffset
package types package types

View File

@@ -1,3 +1,4 @@
//go:build 5BytesOffset
// +build 5BytesOffset // +build 5BytesOffset
package types package types

View File

@@ -1,3 +1,4 @@
//go:build !5BytesOffset
// +build !5BytesOffset // +build !5BytesOffset
package util package util

View File

@@ -1,3 +1,4 @@
//go:build 5BytesOffset
// +build 5BytesOffset // +build 5BytesOffset
package util package util

View File

@@ -1,3 +1,4 @@
//go:build linux || darwin || freebsd || netbsd || openbsd || plan9 || solaris || zos
// +build linux darwin freebsd netbsd openbsd plan9 solaris zos // +build linux darwin freebsd netbsd openbsd plan9 solaris zos
package util package util

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows // +build windows
package util package util

View File

@@ -1,3 +1,4 @@
//go:build !plan9
// +build !plan9 // +build !plan9
package grace package grace

View File

@@ -1,3 +1,4 @@
//go:build plan9
// +build plan9 // +build plan9
package grace package grace