temporalio / temporal

Temporal service
https://docs.temporal.io
MIT License
12.02k stars 850 forks source link

Query for `CloseTime is null` does not return results #6576

Open natenjoy opened 1 month ago

natenjoy commented 1 month ago

Expected Behavior

Query from the command line returns a result for the query that is still in Running status. Query:

temporal workflow list -n preflight --address 10.43.63.119:7233 -q 'CloseTime is null AND WorkflowId = "S329229X8820832"'

Actual Behavior

Query returns no results.

Oddly, if I do the same query but query where close time is not null (CloseTime it not null), I get results for all past workflows AND the currently running workflow.

If I further do a json-formatted output on the list, the one that is running does not show a close time. (query temporal workflow list -n preflight --address 10.43.63.119:7233 -q 'CloseTime is not null AND WorkflowId = "S329229X8820832"' -o json)

{
    "execution": {
      "workflow_id": "S329229X8820832",
      "run_id": "8b9279db-15e6-4296-bb71-e1c2569af382"
    },
    "type": {
      "name": "Preflight"
    },
    "start_time": "2024-09-30T17:19:35.465393Z",
    "status": 1,
    "execution_time": "2024-09-30T17:19:35.465393Z",
    "memo": {},
    "search_attributes": {
      "indexed_fields": {
        "BuildIds": {
          "metadata": {
            "encoding": "anNvbi9wbGFpbg==",
            "type": "S2V5d29yZExpc3Q="
          },
          "data": "WyJ1bnZlcnNpb25lZCIsInVudmVyc2lvbmVkOjczMTQwYjk0MmMzNmQyOWM0YTBjNWY3NTBiMWNjMTEyIl0="
        }
      }
    },
    "task_queue": "PREFLIGHT"
  }

One of the closed ones that does have a close time, does show the close time in the output:

{
    "execution": {
      "workflow_id": "S329229X8820832",
      "run_id": "d3324372-98e0-40e9-a874-326bd48cfc0e"
    },
    "type": {
      "name": "Preflight"
    },
    "start_time": "2024-09-19T20:52:55.034558Z",
    "close_time": "2024-09-26T20:21:24.576403Z",
    "status": 4,
    "history_length": 24,
    "execution_time": "2024-09-19T20:52:55.034558Z",
    "memo": {},
    "search_attributes": {
      "indexed_fields": {
        "BuildIds": {
          "metadata": {
            "encoding": "anNvbi9wbGFpbg==",
            "type": "S2V5d29yZExpc3Q="
          },
          "data": "WyJ1bnZlcnNpb25lZCIsInVudmVyc2lvbmVkOjhkN2JlMGQwYWNiOTUyMDkxOGFiODc3N2I2MTk5NzE2IiwidW52ZXJzaW9uZWQ6NzMxNDBiOTQyYzM2ZDI5YzRhMGM1Zjc1MGIxY2MxMTIiXQ=="
        }
      }
    },
    "task_queue": "PREFLIGHT",
    "state_transition_count": 16,
    "history_size_bytes": 11290
  }

Steps to Reproduce the Problem

  1. Create a workflow that stays running long enough to run queries.
  2. Run the query.

Specifications

The query has worked locally using https://temporal.io/blog/auto-setup and the docker hub image https://hub.docker.com/r/temporalio/server, but does not work in a self hosted environment. Description of the self hosted envrionment:

bergundy commented 2 weeks ago

Thanks, we will take a look.