From f127b326bfca03df506fd8481c74ab874422098d Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 3 May 2022 22:54:31 +0500 Subject: [PATCH] add options to scaffold --- weed/command/scaffold/filer.toml | 12 +++++++----- weed/filer/ydb/readme.md | 1 + weed/filer/ydb/ydb_store.go | 12 ++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/weed/command/scaffold/filer.toml b/weed/command/scaffold/filer.toml index 3a920d80b..595fb2e62 100644 --- a/weed/command/scaffold/filer.toml +++ b/weed/command/scaffold/filer.toml @@ -295,12 +295,14 @@ password="" # skip tls cert validation insecure_skip_verify = true -[ydb] +[ydb] # https://ydb.tech/ enabled = false -useBucketPrefix=true -dsn="grpc://localhost:2136?database=/local" -prefix="en" -poolSizeLimit=50 +dsn = "grpc://localhost:2136?database=/local" +prefix = "seaweedfs" +useBucketPrefix = true # Fast Bucket Deletion +poolSizeLimit = 50 +dialTimeOut = 10 + # Authenticate produced with one of next environment variables: # YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS= — used service account key file by path # YDB_ANONYMOUS_CREDENTIALS="1" — used for authenticate with anonymous access. Anonymous access needs for connect to testing YDB installation diff --git a/weed/filer/ydb/readme.md b/weed/filer/ydb/readme.md index fd6c5c0a2..b617461fd 100644 --- a/weed/filer/ydb/readme.md +++ b/weed/filer/ydb/readme.md @@ -13,6 +13,7 @@ dsn=grpcs://ydb-ru.yandex.net:2135/?database=/ru/home/username/db prefix="seaweedfs" useBucketPrefix=true poolSizeLimit=50 +dialTimeOut = 10 ``` Authenticate produced with one of next environment variables: diff --git a/weed/filer/ydb/ydb_store.go b/weed/filer/ydb/ydb_store.go index 3d40a0400..026b34b4b 100644 --- a/weed/filer/ydb/ydb_store.go +++ b/weed/filer/ydb/ydb_store.go @@ -24,7 +24,7 @@ import ( ) const ( - defaultConnectionTimeOut = 10 + defaultDialTimeOut = 10 ) var ( @@ -58,12 +58,12 @@ func (store *YdbStore) Initialize(configuration util.Configuration, prefix strin configuration.GetString(prefix+"dsn"), configuration.GetString(prefix+"prefix"), configuration.GetBool(prefix+"useBucketPrefix"), - configuration.GetInt(prefix+"connectionTimeOut"), + configuration.GetInt(prefix+"dialTimeOut"), configuration.GetInt(prefix+"poolSizeLimit"), ) } -func (store *YdbStore) initialize(dirBuckets string, dsn string, tablePathPrefix string, useBucketPrefix bool, connectionTimeOut int, poolSizeLimit int) (err error) { +func (store *YdbStore) initialize(dirBuckets string, dsn string, tablePathPrefix string, useBucketPrefix bool, dialTimeOut int, poolSizeLimit int) (err error) { store.dirBuckets = dirBuckets store.SupportBucketTable = useBucketPrefix if store.SupportBucketTable { @@ -72,11 +72,11 @@ func (store *YdbStore) initialize(dirBuckets string, dsn string, tablePathPrefix store.dbs = make(map[string]bool) ctx, cancel := context.WithCancel(context.Background()) defer cancel() - if connectionTimeOut == 0 { - connectionTimeOut = defaultConnectionTimeOut + if dialTimeOut == 0 { + dialTimeOut = defaultDialTimeOut } opts := []ydb.Option{ - ydb.WithDialTimeout(time.Duration(connectionTimeOut) * time.Second), + ydb.WithDialTimeout(time.Duration(dialTimeOut) * time.Second), environ.WithEnvironCredentials(ctx), } if poolSizeLimit > 0 {