mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
more comprehensive value check
This commit is contained in:
parent
1de6085782
commit
5206e8fa0e
1 changed files with 8 additions and 0 deletions
|
|
@ -2721,6 +2721,9 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) {
|
|||
qcx := h.api.Txf().NewQcx()
|
||||
defer qcx.Abort()
|
||||
|
||||
if isImportRequestEmpty(req) {
|
||||
return
|
||||
}
|
||||
if err := h.api.ImportValue(r.Context(), qcx, req, opts...); err != nil {
|
||||
switch errors.Cause(err) {
|
||||
case pilosa.ErrClusterDoesNotOwnShard, pilosa.ErrPreconditionFailed:
|
||||
|
|
@ -3463,3 +3466,8 @@ func (h *Handler) handlePostRestore(w http.ResponseWriter, r *http.Request) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("OK")) //nolint:errcheck
|
||||
}
|
||||
|
||||
func isImportRequestEmpty(req *pilosa.ImportValueRequest) bool {
|
||||
totalData := len(req.Values) + len(req.FloatValues) + len(req.TimestampValues) + len(req.StringValues)
|
||||
return totalData == 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue