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 30c95a0c023f5b..2c5d5dd911d726 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 @@ -129,6 +129,7 @@ public void getServiceId() { } public String addFileStore(FileStoreInfo fsInfo) throws DdlException { + prepare(); try { return client.addFileStore(fsInfo, serviceId); } catch (StarClientException e) { @@ -137,6 +138,7 @@ public String addFileStore(FileStoreInfo fsInfo) throws DdlException { } public void removeFileStoreByName(String fsName) throws DdlException { + prepare(); try { client.removeFileStoreByName(fsName, serviceId); } catch (StarClientException e) { @@ -145,6 +147,7 @@ public void removeFileStoreByName(String fsName) throws DdlException { } public void updateFileStore(FileStoreInfo fsInfo) throws DdlException { + prepare(); try { client.updateFileStore(fsInfo, serviceId); } catch (StarClientException e) { @@ -153,6 +156,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) { @@ -164,6 +168,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) { @@ -175,6 +180,7 @@ public FileStoreInfo getFileStore(String fsKey) throws DdlException { } public List listFileStore() throws DdlException { + prepare(); try { return client.listFileStore(serviceId); } catch (StarClientException e) { @@ -199,6 +205,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) { @@ -214,6 +221,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); @@ -264,6 +272,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 { @@ -284,6 +293,7 @@ private long getWorker(String workerIpPort) throws DdlException { } public long getWorkerTabletNum(String workerIpPort) { + prepare(); try { WorkerInfo workerInfo = client.getWorkerInfo(serviceId, workerIpPort); return workerInfo.getTabletNum(); @@ -344,6 +354,7 @@ private void tryRemovePreviousWorker(long nodeId) { if (prevWorkerId < 0) { return; } + prepare(); try { client.removeWorker(serviceId, prevWorkerId); } catch (StarClientException e) {