diff --git a/fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java b/fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java index aec2cabc03118d..65eb59af160aec 100644 --- a/fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java +++ b/fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java @@ -127,6 +127,7 @@ public void getServiceId() { } public String addFileStore(FileStoreInfo fsInfo) throws DdlException { + prepare(); try { return client.addFileStore(fsInfo, serviceId); } catch (StarClientException e) { @@ -135,6 +136,7 @@ public String addFileStore(FileStoreInfo fsInfo) throws DdlException { } public void removeFileStoreByName(String fsName) throws DdlException { + prepare(); try { client.removeFileStoreByName(fsName, serviceId); } catch (StarClientException e) { @@ -143,6 +145,7 @@ public void removeFileStoreByName(String fsName) throws DdlException { } public void updateFileStore(FileStoreInfo fsInfo) throws DdlException { + prepare(); try { client.updateFileStore(fsInfo, serviceId); } catch (StarClientException e) { @@ -151,6 +154,7 @@ public void updateFileStore(FileStoreInfo fsInfo) throws DdlException { } public FileStoreInfo getFileStoreByName(String fsName) throws DdlException { + prepare(); try { return client.getFileStoreByName(fsName, serviceId); } catch (StarClientException e) { @@ -162,6 +166,7 @@ public FileStoreInfo getFileStoreByName(String fsName) throws DdlException { } public FileStoreInfo getFileStore(String fsKey) throws DdlException { + prepare(); try { return client.getFileStore(fsKey, serviceId); } catch (StarClientException e) { @@ -173,6 +178,7 @@ public FileStoreInfo getFileStore(String fsKey) throws DdlException { } public List listFileStore() throws DdlException { + prepare(); try { return client.listFileStore(serviceId); } catch (StarClientException e) { @@ -197,6 +203,7 @@ private static String constructTablePath(long dbId, long tableId) { } public FilePathInfo allocateFilePath(long dbId, long tableId) throws DdlException { + prepare(); try { FileStoreType fsType = getFileStoreType(Config.cloud_native_storage_type); if (fsType == null || fsType == FileStoreType.INVALID) { @@ -212,6 +219,7 @@ public FilePathInfo allocateFilePath(long dbId, long tableId) throws DdlExceptio } public FilePathInfo allocateFilePath(String storageVolumeId, long dbId, long tableId) throws DdlException { + prepare(); try { String suffix = constructTablePath(dbId, tableId); FilePathInfo pathInfo = client.allocateFilePath(serviceId, storageVolumeId, suffix); @@ -262,6 +270,7 @@ private long getWorker(String workerIpPort) throws DdlException { workerId = workerToId.get(workerIpPort); } else { + prepare(); // When FE && staros restart, workerToId is Empty, but staros already persisted // worker infos, so we need to get workerId from starMgr try { @@ -282,6 +291,7 @@ private long getWorker(String workerIpPort) throws DdlException { } public long getWorkerTabletNum(String workerIpPort) { + prepare(); try { WorkerInfo workerInfo = client.getWorkerInfo(serviceId, workerIpPort); return workerInfo.getTabletNum(); @@ -342,6 +352,7 @@ private void tryRemovePreviousWorker(long nodeId) { if (prevWorkerId < 0) { return; } + prepare(); try { client.removeWorker(serviceId, prevWorkerId); } catch (StarClientException e) {