Skip to content

Commit

Permalink
add prepare() call to every method in StarOSAgent which uses serviceId
Browse files Browse the repository at this point in the history
  • Loading branch information
ctbrennan committed Jan 6, 2025
1 parent e16d942 commit 928b9b7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void getServiceId() {
}

public String addFileStore(FileStoreInfo fsInfo) throws DdlException {
prepare();
try {
return client.addFileStore(fsInfo, serviceId);
} catch (StarClientException e) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -175,6 +180,7 @@ public FileStoreInfo getFileStore(String fsKey) throws DdlException {
}

public List<FileStoreInfo> listFileStore() throws DdlException {
prepare();
try {
return client.listFileStore(serviceId);
} catch (StarClientException e) {
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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();
Expand Down Expand Up @@ -344,6 +354,7 @@ private void tryRemovePreviousWorker(long nodeId) {
if (prevWorkerId < 0) {
return;
}
prepare();
try {
client.removeWorker(serviceId, prevWorkerId);
} catch (StarClientException e) {
Expand Down

0 comments on commit 928b9b7

Please sign in to comment.