[IOTDB-188] Delete storage group#416
Conversation
| return true; | ||
| } | ||
|
|
||
| public void rmStorageGroupInfo(String storageGroupName) { |
There was a problem hiding this comment.
rename to deleteStorageGroup(), call deleteAllDataFilesInOneStorageGroup() first in this method.
| waitForAllCurrentTsFileProcessorsClosed(); | ||
| writeLock(); | ||
| try { | ||
| File storageGroupFolder = TSFileFactory.INSTANCE.getFile(systemDir, storageGroupName); |
There was a problem hiding this comment.
This may be the SystemFactory
| case MetadataOperationType.SET_STORAGE_LEVEL_TO_MTREE: | ||
| setStorageLevelToMTree(args[1]); | ||
| break; | ||
| case MetadataOperationType.DELETE_STORAGE_LEVEL_TO_MTREE: |
There was a problem hiding this comment.
| case MetadataOperationType.DELETE_STORAGE_LEVEL_TO_MTREE: | |
| case MetadataOperationType.DELETE_STORAGE_GROUP_FROM_MTREE: |
| @@ -212,6 +212,9 @@ private void operation(String cmd) | |||
| case MetadataOperationType.SET_STORAGE_LEVEL_TO_MTREE: | |||
There was a problem hiding this comment.
| case MetadataOperationType.SET_STORAGE_LEVEL_TO_MTREE: | |
| case MetadataOperationType.SET_STORAGE_GROUP_TO_MTREE: |
There was a problem hiding this comment.
@qiaojialin Do you want to modify all STORAGE_LEVEL to STORAGE_GROUP? If in that case, the author needs to check all naming.
| /** | ||
| * function for deleting storage level of the given path to mTree. | ||
| */ | ||
| public boolean deleteStorageLevelToMTree(String path) throws MetadataErrorException { |
There was a problem hiding this comment.
| public boolean deleteStorageLevelToMTree(String path) throws MetadataErrorException { | |
| public boolean deleteStorageGroupFromMTree(String path) throws MetadataErrorException { |
| TSStatus deleteTimeseries(1:list<string> path) | ||
| TSStatus deleteTimeseries(1:list<string> path) | ||
|
|
||
| TSStatus deleteStorageGroup(1:TSDeleteDataReq req); |
There was a problem hiding this comment.
| TSStatus deleteStorageGroup(1:TSDeleteDataReq req); | |
| TSStatus deleteStorageGroup(1:string storageGroup); |
There was a problem hiding this comment.
I think it is best if you make it a list.
| } | ||
| } | ||
|
|
||
| public synchronized TSStatus deleteStorageGroup(String storageGroupId, long time) throws IoTDBSessionException { |
There was a problem hiding this comment.
| public synchronized TSStatus deleteStorageGroup(String storageGroupId, long time) throws IoTDBSessionException { | |
| public synchronized TSStatus deleteStorageGroup(String storageGroupId) throws IoTDBSessionException { |
| List<String> paths = new ArrayList<>(); | ||
| paths.add(storageGroupId); | ||
| request.setPaths(paths); | ||
| request.setTimestamp(time); |
| request.setPaths(paths); | ||
| request.setTimestamp(time); | ||
| try { | ||
| return checkAndReturn(client.deleteStorageGroup(request)); |
There was a problem hiding this comment.
| return checkAndReturn(client.deleteStorageGroup(request)); | |
| return checkAndReturn(client.deleteStorageGroup(storageGroup)); |
| } | ||
| } | ||
|
|
||
| public void deleteStorageGroupTest() throws ClassNotFoundException, SQLException, IoTDBSessionException { |
There was a problem hiding this comment.
| public void deleteStorageGroupTest() throws ClassNotFoundException, SQLException, IoTDBSessionException { | |
| public void deleteStorageGroup() throws ClassNotFoundException, SQLException, IoTDBSessionException { |
server/src/main/java/org/apache/iotdb/db/metadata/MetadataOperationType.java
Outdated
Show resolved
Hide resolved
| @@ -212,6 +212,9 @@ private void operation(String cmd) | |||
| case MetadataOperationType.SET_STORAGE_LEVEL_TO_MTREE: | |||
There was a problem hiding this comment.
@qiaojialin Do you want to modify all STORAGE_LEVEL to STORAGE_GROUP? If in that case, the author needs to check all naming.
server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
Outdated
Show resolved
Hide resolved
jt2594838
left a comment
There was a problem hiding this comment.
Great but with some small issues.
server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
Outdated
Show resolved
Hide resolved
| logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME); | ||
| return new TSStatus(getStatus(TSStatusCode.NOT_LOGIN_ERROR)); | ||
| } | ||
| MetadataPlan plan = new MetadataPlan(MetadataOperator.NamespaceType.DELETE_STORAGE_GROUP,new Path(req.getPaths().get(0))); |
There was a problem hiding this comment.
So only one storage group is supported at the same time? I guess it is not difficult to support deleting multiple groups with one request, try if you can.
There was a problem hiding this comment.
As the issue defined in IOTDB-188, I just need to delete a single storage group at the same time, and Qiaojialin said to me that before we complete the batch deletion of storage groups, we should change some of the structure of the Metadata, so he suggested me to submit this version first.
There was a problem hiding this comment.
You can always go beyond the issue as long as it is helpful, but it is fine to leave it as future work.
server/src/main/java/org/apache/iotdb/db/sync/receiver/SyncServiceImpl.java
Outdated
Show resolved
Hide resolved
| TSStatus deleteTimeseries(1:list<string> path) | ||
| TSStatus deleteTimeseries(1:list<string> path) | ||
|
|
||
| TSStatus deleteStorageGroup(1:TSDeleteDataReq req); |
There was a problem hiding this comment.
I think it is best if you make it a list.
|
Rename the title to "[IOTDB-XXX]..." and provide the Jira link, please. |
…e requested changes
Complete a function using session to delete storage groups in iotdb. Delete all the data of this storage group after calling this function.
Jira link: https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-188