You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2024/03/06 00:37:25 UTC

(skywalking-banyandb) 01/01: Remove redundant sync operation in fs

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch win
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit d09e9906e9a79a643e93c0a1cd79dc82a1e82ab7
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Wed Mar 6 00:26:23 2024 +0000

    Remove redundant sync operation in fs
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 .github/workflows/flaky-test.yml |  4 ++--
 pkg/fs/local_file_system.go      | 16 +---------------
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/flaky-test.yml b/.github/workflows/flaky-test.yml
index 3420da1d..e789870c 100644
--- a/.github/workflows/flaky-test.yml
+++ b/.github/workflows/flaky-test.yml
@@ -28,5 +28,5 @@ jobs:
     if: github.repository == 'apache/skywalking-banyandb'
     uses: ./.github/workflows/test.yml
     with:
-      options: --repeat 49 --label-filter '(integration&&!slow)||banyand'
-      timeout-minutes: 40
+      options: --repeat 3 --label-filter '(integration&&!slow)||banyand'
+      timeout-minutes: 50
diff --git a/pkg/fs/local_file_system.go b/pkg/fs/local_file_system.go
index 7a8b1904..ccea483e 100644
--- a/pkg/fs/local_file_system.go
+++ b/pkg/fs/local_file_system.go
@@ -100,7 +100,7 @@ func (fs *localFileSystem) mkdir(path string, permission Mode) {
 		fs.logger.Panic().Str("path", path).Err(err).Msg("failed to create directory")
 	}
 	parentDirPath := filepath.Dir(path)
-	fs.syncPath(parentDirPath)
+	fs.SyncPath(parentDirPath)
 }
 
 func (fs *localFileSystem) pathExist(path string) bool {
@@ -113,20 +113,6 @@ func (fs *localFileSystem) pathExist(path string) bool {
 	return true
 }
 
-func (fs *localFileSystem) syncPath(path string) {
-	d, err := os.Open(path)
-	if err != nil {
-		fs.logger.Panic().Str("path", path).Err(err).Msg("failed to open directory")
-	}
-	if err := d.Sync(); err != nil {
-		_ = d.Close()
-		fs.logger.Panic().Str("path", path).Err(err).Msg("failed to sync directory")
-	}
-	if err := d.Close(); err != nil {
-		fs.logger.Panic().Str("path", path).Err(err).Msg("ailed to sync directory")
-	}
-}
-
 func (fs *localFileSystem) ReadDir(dirname string) []DirEntry {
 	des, err := os.ReadDir(dirname)
 	if err != nil {