Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access is denied #772

Closed
dreamsxin opened this issue Mar 23, 2024 · 5 comments
Closed

Access is denied #772

dreamsxin opened this issue Mar 23, 2024 · 5 comments

Comments

@dreamsxin
Copy link

dreamsxin commented Mar 23, 2024

sync frostdb\\databases\\test\\wal: Access is denied.
OS: windows 10
GO:go version go1.21.5 windows/amd64

func main() {
	logger := kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(os.Stdout))                          //NewJSONLogger
	logger = kitlog.With(logger, "ts", kitlog.DefaultTimestampUTC, "caller", kitlog.Caller(4)) //kitlog.Caller
	stdlog.SetOutput(kitlog.NewStdlibAdapter(logger))
	stdlog.Print("I sure like pie")

	dir := "frostdb"
	_, err := os.Stat(dir)
	if err != nil {
		err := os.Mkdir(dir, 0755)
		if err != nil {
			stdlog.Panicln("MkdirTemp", err)
		}
	}
	bucket := objstore.NewInMemBucket()

	sinksource := frostdb.NewDefaultObjstoreBucket(bucket)

	c, err := frostdb.New(
		frostdb.WithLogger(logger),
		frostdb.WithWAL(),
		frostdb.WithStoragePath(dir),
		frostdb.WithReadWriteStorage(sinksource),
		frostdb.WithActiveMemorySize(100*frostdb.KiB),
	)
	if err != nil {
		stdlog.Panicln("frostdb.New", err)
	}

	db, err := c.DB(context.Background(), "test")
	if err != nil {
		stdlog.Panicln("frostdb.DB", err)
	}
@metalmatze
Copy link
Member

The database itself should create that directory. No need to use os.Mkdir.

@dreamsxin
Copy link
Author

The database itself should create that directory. No need to use os.Mkdir.

Thks, I will test it

@dreamsxin
Copy link
Author

Same mistake panic: frostdb.New failed initializing meta DB: sync frostdb\databases\test\wal: Access is denied.

package main

import (
	"context"
	stdlog "log"

	"github.com/apache/arrow/go/v15/arrow"
	"github.com/apache/arrow/go/v15/arrow/memory"
	"github.com/thanos-io/objstore"

	"github.com/polarsignals/frostdb"
	"github.com/polarsignals/frostdb/dynparquet"
	"github.com/polarsignals/frostdb/query/logicalplan"
)

func main() {
	stdlog.SetFlags(stdlog.LstdFlags | stdlog.Lshortfile)
	stdlog.Print("I sure like pie")

	dir := "frostdb"
	bucket := objstore.NewInMemBucket()

	sinksource := frostdb.NewDefaultObjstoreBucket(bucket)

	// 创建 ColumnStore 对象
	c, err := frostdb.New(
		frostdb.WithWAL(),
		frostdb.WithStoragePath(dir),
		frostdb.WithReadWriteStorage(sinksource),
		frostdb.WithActiveMemorySize(100*frostdb.KiB),
	)
	if err != nil {
		stdlog.Panicln("frostdb.New", err)
	}

@dreamsxin dreamsxin reopened this Mar 26, 2024
@thorfour
Copy link
Contributor

thorfour commented Mar 26, 2024

I would check the permissions of the directory that the program is running in. It seems like the program doesn't have permissions to create a directory in the frostdb dir. This doesn't appear to be a FrostDB issue but a local permissions issue.

Alternatively you could update your test to perform a MkdirAll("frostdb\databases\test\wal", 0755)

@budyaya
Copy link

budyaya commented Jul 1, 2024

Errors only occur on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants