USACE / USACE/cwms-data-api

Removing a timeseries from timeseries group errors with large groups

Open
#1,654 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
28
Forks
25
Avg merge
4d 22h
Merged PRs (30d)
20

Description

Describe the bug
In CWMS-Vue using CDA for cwbi-test user removes a single timeseries from a large timeseries group (>1,000). The behavior uses replace-assigned-ts=true so it will delete all timeseries in the group and then reload then. With such a large timeseries group this is causing an error.

https://discourse.hecdev.net/t/v4-2-0-09-beta-cannot-unassign-time-series-from-time-series-group/4574

Expected behavior
We should have the behavior to remove a timeseries or subset of timeseries to just remove those timeseries and not have to do a replace-assigned-ts. Have a remove-ts or something like that. json would old the ones to remove and then it would just remove those.

To Reproduce
In CWMS-Vue for LRL. try to remove a timeseries group from the Data Acquisition-> SHEF timeseries group. Have not tested if this is the same from CDA directly.

Logs/Incident Identifier
08:41:01 INFO: Committing manager: Time Series Groups
08:41:03 WARNING: Error removing time series group SHEF Data Acquisition from database.
java.util.concurrent.CompletionException: hec.db.DbRuntimeException: hec.db.DbIoException: mil.army.usace.hec.cwms.http.client.CwmsHttpResponseException: Unknown error occurred for request: PATCH https://cwms-data-test.cwbi.us/cwms-data/timeseries/group/SHEF%20Data%20Acquisition?replace-assigned-ts=true&office=CWMS
Error code: 400 Bad Request

<title>400 Bad Request</title>

Bad Request

Your browser sent a request that this server could not understand.

    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)

Caused by: hec.db.DbRuntimeException: hec.db.DbIoException: mil.army.usace.hec.cwms.http.client.CwmsHttpResponseException: Unknown error occurred for request: PATCH https://cwms-data-test.cwbi.us/cwms-data/timeseries/group/SHEF%20Data%20Acquisition?replace-assigned-ts=true&office=CWMS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PATCH /timeseries/group/{group}?replace-assigned-ts=true request shown in the logs and review the linked reproduction context. Trace how assigned time series are removed for large groups, then add coverage for removing a subset without replacing the entire assignment and verify the request succeeds for groups over 1,000 entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.