From d5083adab9502c59fffebdb65d5d26c5a2023987 Mon Sep 17 00:00:00 2001 From: Dan Wang Date: Thu, 7 Mar 2024 15:25:51 +0800 Subject: [PATCH] fix maxWaitSeconds --- go-client/admin/client.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/go-client/admin/client.go b/go-client/admin/client.go index 076fadc5a2..9f4c30b347 100644 --- a/go-client/admin/client.go +++ b/go-client/admin/client.go @@ -43,7 +43,9 @@ type Client interface { SetTimeout(timeout time.Duration) // `maxWaitSeconds` specify the number of seconds that is spent on waiting for - // the table to be created. + // the created table to be ready. This method would return error once the table + // is still not ready after `maxWaitSeconds`. The administrator should check if + // there is something wrong with the table. CreateTable(tableName string, partitionCount int32, replicaCount int32, envs map[string]string, maxWaitSeconds int32, successIfExistOptional ...bool) (int32, error) // `reserveSeconds` specify the retention interval for a table before it is actually dropped. @@ -143,6 +145,11 @@ func (c *rpcBasedClient) waitTableReady(tableName string, partitionCount int32, } time.Sleep(time.Second) } + + if maxWaitSeconds <= 0 { + return fmt.Errorf("After %d seconds, table '%s' is still not ready", tableName) + } + return nil }