Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-27201

RQG query returns cause: write /tmp/scan-results2666872857286: file already closed

    XMLWordPrintable

Details

    • Untriaged
    • Unknown

    Description

      This query, on a typical rqg setup 5 buckets, a secondary index on each field as well as a secondary index that contains all fields of the bucket. Logs are attached

      SELECT  t_2.*  FROM  multiple_table_db_8552_simple_table_3 t_5  INNER JOIN  multiple_table_db_8552_simple_table_10 t_4 ON ( t_5.char_field1 = t_4.char_field1 )   INNER JOIN  multiple_table_db_8552_simple_table_2 t_1 ON ( t_5.int_field1 = t_1.int_field1 )   LEFT JOIN  multiple_table_db_8552_simple_table_1 t_3 ON ( t_5.int_field1 = t_3.int_field1 )   INNER JOIN  multiple_table_db_8552_simple_table_4 t_2 ON ( t_3.int_field1 = t_2.int_field1 )     WHERE  NOT (((((NOT (NOT ((t_3.bool_field1 != true AND t_1.decimal_field1 IS NULL)))) AND (((NOT (t_2.bool_field1) OR NOT (t_1.decimal_field1 != 4780))) AND ((t_1.bool_field1 = true AND t_1.primary_key_id NOT BETWEEN "1" and "999")) OR ((NOT (t_3.bool_field1) OR t_4.decimal_field1 <= 5045)) AND ((NOT (t_4.bool_field1) AND t_1.varchar_field1 > "aorVXRMhfH")))) OR (NOT ((t_5.bool_field1 != true AND t_3.int_field1 > 5259)))) OR ((NOT (t_3.bool_field1)) OR (t_4.bool_field1 != false))) OR (((t_3.bool_field1 OR t_2.int_field1 IS NULL)) AND ((t_1.int_field1 < 5225 AND t_2.char_field1 <= "N" AND t_1.bool_field1 != false))))    ORDER BY   t_4.int_field1 ,  t_4.primary_key_id ,  t_4.bool_field1

       

      returns this error message:

      [
      {
      "code": 5000,
      "msg": "write /tmp/scan-results2666872857286: file already closed - cause: write /tmp/scan-results2666872857286: file already closed",
      "query_from_user": "SELECT t_2.* FROM multiple_table_db_8552_simple_table_3 t_5 INNER JOIN multiple_table_db_8552_simple_table_10 t_4 ON ( t_5.char_field1 = t_4.char_field1 ) INNER JOIN multiple_table_db_8552_simple_table_2 t_1 ON ( t_5.int_field1 = t_1.int_field1 ) LEFT JOIN multiple_table_db_8552_simple_table_1 t_3 ON ( t_5.int_field1 = t_3.int_field1 ) INNER JOIN multiple_table_db_8552_simple_table_4 t_2 ON ( t_3.int_field1 = t_2.int_field1 ) WHERE NOT (((((NOT (NOT ((t_3.bool_field1 != true AND t_1.decimal_field1 IS NULL)))) AND (((NOT (t_2.bool_field1) OR NOT (t_1.decimal_field1 != 4780))) AND ((t_1.bool_field1 = true AND t_1.primary_key_id NOT BETWEEN \"1\" and \"999\")) OR ((NOT (t_3.bool_field1) OR t_4.decimal_field1 <= 5045)) AND ((NOT (t_4.bool_field1) AND t_1.varchar_field1 > \"aorVXRMhfH\")))) OR (NOT ((t_5.bool_field1 != true AND t_3.int_field1 > 5259)))) OR ((NOT (t_3.bool_field1)) OR (t_4.bool_field1 != false))) OR (((t_3.bool_field1 OR t_2.int_field1 IS NULL)) AND ((t_1.int_field1 < 5225 AND t_2.char_field1 <= \"N\" AND t_1.bool_field1 != false)))) ORDER BY t_4.int_field1 , t_4.primary_key_id , t_4.bool_field1"
      },
      {
      "code": 5000,
      "msg": "write /tmp/scan-results2666020283876: file already closed - cause: write /tmp/scan-results2666020283876: file already closed"
      }
      ]

       

      Here is the explain:

      {
      "plan": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "UnionScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "as": "t_5",
      "index": "simple_table_3_bool_field1",
      "index_id": "ac72f28d7c684267",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_3",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "true",
      "inclusion": 0,
      "low": "null"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "as": "t_5",
      "index": "simple_table_3_bool_field1",
      "index_id": "ac72f28d7c684267",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_3",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "Fetch",
      "as": "t_5",
      "keyspace": "multiple_table_db_8552_simple_table_3",
      "namespace": "default"
      },
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "AnsiJoin",
      "alias": "t_4",
      "on_clause": "((`t_5`.`char_field1`) = (`t_4`.`char_field1`))",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_4",
      "index": "simple_table_10_bool_field1",
      "index_id": "dbd52c98ed7b5677",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_10",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "false",
      "inclusion": 3,
      "low": "false"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_4",
      "index": "simple_table_10_char_field1",
      "index_id": "906696d8b3a7e2c2",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_10",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_5`.`char_field1`)",
      "inclusion": 3,
      "low": "(`t_5`.`char_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "Fetch",
      "ansi_join": true,
      "as": "t_4",
      "keyspace": "multiple_table_db_8552_simple_table_10",
      "namespace": "default"
      }
      ]
      }
      },
      {
      "#operator": "AnsiJoin",
      "alias": "t_1",
      "on_clause": "((`t_5`.`int_field1`) = (`t_1`.`int_field1`))",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_1",
      "index": "simple_table_2_int_field1",
      "index_id": "2112bd14e26d8ccf",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_2",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_5`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_5`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "Fetch",
      "ansi_join": true,
      "as": "t_1",
      "keyspace": "multiple_table_db_8552_simple_table_2",
      "namespace": "default"
      }
      ]
      }
      },
      {
      "#operator": "AnsiJoin",
      "alias": "t_3",
      "on_clause": "((`t_5`.`int_field1`) = (`t_3`.`int_field1`))",
      "outer": true,
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_3",
      "index": "simple_table_1_bool_field1",
      "index_id": "afe68e9c6c96f7ec",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_1",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_3",
      "index": "simple_table_1_int_field1",
      "index_id": "d3cf3066db3d5ad9",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_1",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "high": "(`t_5`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_5`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "Fetch",
      "ansi_join": true,
      "as": "t_3",
      "keyspace": "multiple_table_db_8552_simple_table_1",
      "namespace": "default"
      }
      ]
      }
      },
      {
      "#operator": "AnsiJoin",
      "alias": "t_2",
      "on_clause": "((`t_3`.`int_field1`) = (`t_2`.`int_field1`))",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "UnionScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_char_field1",
      "index_id": "2b64707f980dc36d",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "\"N\""
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_char_field1",
      "index_id": "2b64707f980dc36d",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "\"N\""
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_bool_field1",
      "index_id": "428e584f5229d2cd",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_bool_field1",
      "index_id": "428e584f5229d2cd",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_char_field1",
      "index_id": "2b64707f980dc36d",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "\"N\""
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_bool_field1",
      "index_id": "428e584f5229d2cd",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_char_field1",
      "index_id": "2b64707f980dc36d",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "\"N\""
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_bool_field1",
      "index_id": "428e584f5229d2cd",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      },
      {
      "#operator": "IntersectScan",
      "scans": [
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_int_field1",
      "index_id": "4edf33b06a566a86",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "high": "(`t_3`.`int_field1`)",
      "inclusion": 3,
      "low": "(`t_3`.`int_field1`)"
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_char_field1",
      "index_id": "2b64707f980dc36d",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "exact": true,
      "range": [
      {
      "inclusion": 0,
      "low": "\"N\""
      }
      ]
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "IndexScan2",
      "ansi_join": true,
      "as": "t_2",
      "index": "simple_table_4_bool_field1",
      "index_id": "428e584f5229d2cd",
      "index_projection": {
      "primary_key": true
      },
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default",
      "spans": [
      {
      "range": [
      {
      "inclusion": 1,
      "low": "true"
      }
      ]
      }
      ],
      "using": "gsi"
      }
      ]
      }
      ]
      },
      {
      "#operator": "Fetch",
      "ansi_join": true,
      "as": "t_2",
      "keyspace": "multiple_table_db_8552_simple_table_4",
      "namespace": "default"
      }
      ]
      }
      },
      {
      "#operator": "Filter",
      "condition": "(not (((((not (not ((not ((`t_3`.`bool_field1`) = true)) and ((`t_1`.`decimal_field1`) is null)))) and ((((not (`t_2`.`bool_field1`)) or (not (not ((`t_1`.`decimal_field1`) = 4780)))) and (((`t_1`.`bool_field1`) = true) and (not ((`t_1`.`primary_key_id`) between \"1\" and \"999\")))) or (((not (`t_3`.`bool_field1`)) or ((`t_4`.`decimal_field1`) <= 5045)) and ((not (`t_4`.`bool_field1`)) and (\"aorVXRMhfH\" < (`t_1`.`varchar_field1`)))))) or (not ((not ((`t_5`.`bool_field1`) = true)) and (5259 < (`t_3`.`int_field1`))))) or ((not (`t_3`.`bool_field1`)) or (not ((`t_4`.`bool_field1`) = false)))) or (((`t_3`.`bool_field1`) or ((`t_2`.`int_field1`) is null)) and ((((`t_1`.`int_field1`) < 5225) and ((`t_2`.`char_field1`) <= \"N\")) and (not ((`t_1`.`bool_field1`) = false))))))"
      },
      {
      "#operator": "InitialProject",
      "result_terms": [
      {
      "expr": "`t_2`",
      "star": true
      }
      ]
      }
      ]
      }
      }
      ]
      },
      {
      "#operator": "Order",
      "sort_terms": [
      {
      "expr": "(`t_4`.`int_field1`)"
      },
      {
      "expr": "(`t_4`.`primary_key_id`)"
      },
      {
      "expr": "(`t_4`.`bool_field1`)"
      }
      ]
      },
      {
      "#operator": "FinalProject"
      }
      ]
      },
      "text": "SELECT t_2.* FROM multiple_table_db_8552_simple_table_3 t_5 INNER JOIN multiple_table_db_8552_simple_table_10 t_4 ON ( t_5.char_field1 = t_4.char_field1 ) INNER JOIN multiple_table_db_8552_simple_table_2 t_1 ON ( t_5.int_field1 = t_1.int_field1 ) LEFT JOIN multiple_table_db_8552_simple_table_1 t_3 ON ( t_5.int_field1 = t_3.int_field1 ) INNER JOIN multiple_table_db_8552_simple_table_4 t_2 ON ( t_3.int_field1 = t_2.int_field1 ) WHERE NOT (((((NOT (NOT ((t_3.bool_field1 != true AND t_1.decimal_field1 IS NULL)))) AND (((NOT (t_2.bool_field1) OR NOT (t_1.decimal_field1 != 4780))) AND ((t_1.bool_field1 = true AND t_1.primary_key_id NOT BETWEEN \"1\" and \"999\")) OR ((NOT (t_3.bool_field1) OR t_4.decimal_field1 <= 5045)) AND ((NOT (t_4.bool_field1) AND t_1.varchar_field1 > \"aorVXRMhfH\")))) OR (NOT ((t_5.bool_field1 != true AND t_3.int_field1 > 5259)))) OR ((NOT (t_3.bool_field1)) OR (t_4.bool_field1 != false))) OR (((t_3.bool_field1 OR t_2.int_field1 IS NULL)) AND ((t_1.int_field1 < 5225 AND t_2.char_field1 <= \"N\" AND t_1.bool_field1 != false)))) ORDER BY t_4.int_field1 , t_4.primary_key_id , t_4.bool_field1"
      }

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              jliang John Liang
              ajay.bhullar Ajay Bhullar
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty