@@ -127,6 +127,7 @@ public void getServiceId() {
127127 }
128128
129129 public String addFileStore (FileStoreInfo fsInfo ) throws DdlException {
130+ prepare ();
130131 try {
131132 return client .addFileStore (fsInfo , serviceId );
132133 } catch (StarClientException e ) {
@@ -135,6 +136,7 @@ public String addFileStore(FileStoreInfo fsInfo) throws DdlException {
135136 }
136137
137138 public void removeFileStoreByName (String fsName ) throws DdlException {
139+ prepare ();
138140 try {
139141 client .removeFileStoreByName (fsName , serviceId );
140142 } catch (StarClientException e ) {
@@ -143,6 +145,7 @@ public void removeFileStoreByName(String fsName) throws DdlException {
143145 }
144146
145147 public void updateFileStore (FileStoreInfo fsInfo ) throws DdlException {
148+ prepare ();
146149 try {
147150 client .updateFileStore (fsInfo , serviceId );
148151 } catch (StarClientException e ) {
@@ -151,6 +154,7 @@ public void updateFileStore(FileStoreInfo fsInfo) throws DdlException {
151154 }
152155
153156 public FileStoreInfo getFileStoreByName (String fsName ) throws DdlException {
157+ prepare ();
154158 try {
155159 return client .getFileStoreByName (fsName , serviceId );
156160 } catch (StarClientException e ) {
@@ -162,6 +166,7 @@ public FileStoreInfo getFileStoreByName(String fsName) throws DdlException {
162166 }
163167
164168 public FileStoreInfo getFileStore (String fsKey ) throws DdlException {
169+ prepare ();
165170 try {
166171 return client .getFileStore (fsKey , serviceId );
167172 } catch (StarClientException e ) {
@@ -173,6 +178,7 @@ public FileStoreInfo getFileStore(String fsKey) throws DdlException {
173178 }
174179
175180 public List <FileStoreInfo > listFileStore () throws DdlException {
181+ prepare ();
176182 try {
177183 return client .listFileStore (serviceId );
178184 } catch (StarClientException e ) {
@@ -197,6 +203,7 @@ private static String constructTablePath(long dbId, long tableId) {
197203 }
198204
199205 public FilePathInfo allocateFilePath (long dbId , long tableId ) throws DdlException {
206+ prepare ();
200207 try {
201208 FileStoreType fsType = getFileStoreType (Config .cloud_native_storage_type );
202209 if (fsType == null || fsType == FileStoreType .INVALID ) {
@@ -212,6 +219,7 @@ public FilePathInfo allocateFilePath(long dbId, long tableId) throws DdlExceptio
212219 }
213220
214221 public FilePathInfo allocateFilePath (String storageVolumeId , long dbId , long tableId ) throws DdlException {
222+ prepare ();
215223 try {
216224 String suffix = constructTablePath (dbId , tableId );
217225 FilePathInfo pathInfo = client .allocateFilePath (serviceId , storageVolumeId , suffix );
@@ -262,6 +270,7 @@ private long getWorker(String workerIpPort) throws DdlException {
262270 workerId = workerToId .get (workerIpPort );
263271
264272 } else {
273+ prepare ();
265274 // When FE && staros restart, workerToId is Empty, but staros already persisted
266275 // worker infos, so we need to get workerId from starMgr
267276 try {
@@ -282,6 +291,7 @@ private long getWorker(String workerIpPort) throws DdlException {
282291 }
283292
284293 public long getWorkerTabletNum (String workerIpPort ) {
294+ prepare ();
285295 try {
286296 WorkerInfo workerInfo = client .getWorkerInfo (serviceId , workerIpPort );
287297 return workerInfo .getTabletNum ();
@@ -342,6 +352,7 @@ private void tryRemovePreviousWorker(long nodeId) {
342352 if (prevWorkerId < 0 ) {
343353 return ;
344354 }
355+ prepare ();
345356 try {
346357 client .removeWorker (serviceId , prevWorkerId );
347358 } catch (StarClientException e ) {
0 commit comments