mirror of https://github.com/milvus-io/milvus.git
restful api /collections/{collection_name}/partitions (DELETE) didn't work (#4539)
Signed-off-by: fishpenguin <kun.yu@zilliz.com> Signed-off-by: shengjun.li <shengjun.li@zilliz.com>pull/4560/head
parent
1210296ce2
commit
74e0c373d8
|
@ -42,6 +42,7 @@ Please mark all changes in change log and use the issue from GitHub
|
||||||
- \#4418 Fix search when there are multiple vector fields
|
- \#4418 Fix search when there are multiple vector fields
|
||||||
- \#4488 get_entity_by_id() performance is poor in 0.11.0
|
- \#4488 get_entity_by_id() performance is poor in 0.11.0
|
||||||
- \#4511 Insert should be failed if field type not matched
|
- \#4511 Insert should be failed if field type not matched
|
||||||
|
- \#4536 restful api /collections/{collection_name}/partitions (DELETE) didn't work
|
||||||
|
|
||||||
## Feature
|
## Feature
|
||||||
- \#4163 Update C++ sdk search interface
|
- \#4163 Update C++ sdk search interface
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
- [`/collections/{collection_name}/partitions` (GET)](#collectionscollection_namepartitions-get)
|
- [`/collections/{collection_name}/partitions` (GET)](#collectionscollection_namepartitions-get)
|
||||||
- [`/collections/{collection_name}/partitions` (POST)](#collectionscollection_namepartitions-post)
|
- [`/collections/{collection_name}/partitions` (POST)](#collectionscollection_namepartitions-post)
|
||||||
- [`/collections/{collection_name}/partitions` (OPTIONS)](#collectionscollection_namepartitions-options)
|
- [`/collections/{collection_name}/partitions` (OPTIONS)](#collectionscollection_namepartitions-options)
|
||||||
- [`/collections/{collection_name}/partitions` (DELETE)](#collectionscollection_namepartitions-delete)
|
- [`/collections/{collection_name}/partitions/{partition_tag}` (DELETE)](#collectionscollection_namepartitions-delete)
|
||||||
- [`/collections/{collection_name}/segments/{segment_name}/ids` (GET)](#collectionscollection_namesegmentssegment_nameids-get)
|
- [`/collections/{collection_name}/segments/{segment_name}/ids` (GET)](#collectionscollection_namesegmentssegment_nameids-get)
|
||||||
- [`/collections/{collection_name}/entities` (POST)](#collectionscollection_nameentities-post)
|
- [`/collections/{collection_name}/entities` (POST)](#collectionscollection_nameentities-post)
|
||||||
- [`/collections/{collection_name}/entities` (DELETE)](#collectionscollection_nameentities-delete)
|
- [`/collections/{collection_name}/entities` (DELETE)](#collectionscollection_nameentities-delete)
|
||||||
|
@ -644,7 +644,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
|
||||||
$ curl -X OPTIONS "http://127.0.0.1:19121/collections/test_collection/partitions"
|
$ curl -X OPTIONS "http://127.0.0.1:19121/collections/test_collection/partitions"
|
||||||
```
|
```
|
||||||
|
|
||||||
### `/collections/{collection_name}/partitions` (DELETE)
|
### `/collections/{collection_name}/partitions/{partition_tag}` (DELETE)
|
||||||
|
|
||||||
Deletes a partition by tag.
|
Deletes a partition by tag.
|
||||||
|
|
||||||
|
@ -652,13 +652,8 @@ Deletes a partition by tag.
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Request Component</th><th>Value</th></tr>
|
<tr><th>Request Component</th><th>Value</th></tr>
|
||||||
<tr><td> Name</td><td><pre><code>/collections/{collection_name}/partitions</code></pre></td></tr>
|
<tr><td> Name</td><td><pre><code>/collections/{collection_name}/partitions/{partition_tag}</code></pre></td></tr>
|
||||||
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
|
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
|
||||||
<tr><td>Body</td><td><pre><code>
|
|
||||||
{
|
|
||||||
"partition_tag": string
|
|
||||||
}
|
|
||||||
</code></pre> </td></tr>
|
|
||||||
<tr><td>Method</td><td>POST</td></tr>
|
<tr><td>Method</td><td>POST</td></tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
@ -683,7 +678,7 @@ Deletes a partition by tag.
|
||||||
##### Request
|
##### Request
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ curl -X DELETE "http://127.0.0.1:19121/collections/test_collection/partitions" -H "accept: application/json" -d "{\"partition_tag\": \"tags_01\"}"
|
$ curl -X DELETE "http://127.0.0.1:19121/collections/test_collection/partitions/test_partition" -H "accept: application/json"
|
||||||
```
|
```
|
||||||
|
|
||||||
The deletion is successful if no information is returned.
|
The deletion is successful if no information is returned.
|
||||||
|
|
|
@ -529,8 +529,8 @@ class WebController : public oatpp::web::server::api::ApiController {
|
||||||
|
|
||||||
ADD_DEFAULT_CORS(DropPartition)
|
ADD_DEFAULT_CORS(DropPartition)
|
||||||
|
|
||||||
ENDPOINT("DELETE", "/collections/{collection_name}/partitions", DropPartition, PATH(String, collection_name),
|
ENDPOINT("DELETE", "/collections/{collection_name}/partitions/{partition_tag}", DropPartition,
|
||||||
BODY_STRING(String, body)) {
|
PATH(String, collection_name), PATH(String, partition_tag)) {
|
||||||
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "DELETE \'/collections/" + collection_name->std_str() +
|
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "DELETE \'/collections/" + collection_name->std_str() +
|
||||||
"/partitions\'");
|
"/partitions\'");
|
||||||
tr.RecordSection("Received request.");
|
tr.RecordSection("Received request.");
|
||||||
|
@ -538,7 +538,7 @@ class WebController : public oatpp::web::server::api::ApiController {
|
||||||
auto handler = WebRequestHandler();
|
auto handler = WebRequestHandler();
|
||||||
|
|
||||||
std::shared_ptr<OutgoingResponse> response;
|
std::shared_ptr<OutgoingResponse> response;
|
||||||
auto status_dto = handler.DropPartition(collection_name, body);
|
auto status_dto = handler.DropPartition(collection_name, partition_tag);
|
||||||
switch (*(status_dto->code)) {
|
switch (*(status_dto->code)) {
|
||||||
case StatusCode::SUCCESS:
|
case StatusCode::SUCCESS:
|
||||||
response = createDtoResponse(Status::CODE_204, status_dto);
|
response = createDtoResponse(Status::CODE_204, status_dto);
|
||||||
|
|
|
@ -1495,16 +1495,8 @@ WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryPa
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusDtoT
|
StatusDtoT
|
||||||
WebRequestHandler::DropPartition(const OString& collection_name, const OString& body) {
|
WebRequestHandler::DropPartition(const OString& collection_name, const OString& partition_tag) {
|
||||||
std::string tag;
|
std::string tag = partition_tag->std_str();
|
||||||
try {
|
|
||||||
auto json = milvus::json::parse(body->std_str());
|
|
||||||
tag = json["partition_tag"].get<std::string>();
|
|
||||||
} catch (nlohmann::detail::parse_error& e) {
|
|
||||||
RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what())
|
|
||||||
} catch (nlohmann::detail::type_error& e) {
|
|
||||||
RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what())
|
|
||||||
}
|
|
||||||
auto status = req_handler_.DropPartition(context_ptr_, collection_name->std_str(), tag);
|
auto status = req_handler_.DropPartition(context_ptr_, collection_name->std_str(), tag);
|
||||||
|
|
||||||
ASSIGN_RETURN_STATUS_DTO(status)
|
ASSIGN_RETURN_STATUS_DTO(status)
|
||||||
|
|
Loading…
Reference in New Issue