Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

runStream returning incomplete and out of order rows #180

@bbransteitter

Description

@bbransteitter

Environment details

  • OS: Ubuntu 16.04.4 LTS
  • Node.js version: 6.14.1
  • npm version: 5.8.0
  • @google-cloud/spanner version: 1.4.1

Steps to reproduce

I have a table with this structure:

CREATE TABLE accounts (
    recordId STRING(36) NOT NULL,
    account_CID STRING(255),
    account_created_on STRING(1024),
    account_created_on_unixTimestamp FLOAT64,
    account_dashboard_tabs STRING(255),
    account_ok_tabs STRING(255),
    account_summary_content_tabs STRING(255),
    account_to_creator STRING(36),
    account_to_customer_admin STRING(36),
    account_view_tabs STRING(255),
    Address STRING(1024),
    Address1 STRING(1024),
    Address1_city STRING(255),
    Address1_postalcode STRING(255),
    Address1_provinceterritory STRING(255),
    Address_city STRING(255),
    Address_postalcode STRING(255),
    Address_provinceterritory STRING(255),
    current_document_number FLOAT64,
    customer_content_tabs STRING(255),
    Email STRING(255),
    fund_to_account STRING(36),
    FundsTab_AccountSubNavigation STRING(255),
    Number FLOAT64,
    Number1 FLOAT64,
    Number_of_Payments FLOAT64,
    payment_plan_to_account STRING(36),
    Phone_Number STRING(1024),
    Phone_Number1 STRING(1024),
    requested_payment_plan_to_account STRING(36),
    RequestRelationshipCID STRING(255),
    RequestRelationshipContentTab STRING(255),
    Selection_Field___Static STRING(MAX),
    Short_Text STRING(255),
    Short_Text1 STRING(255),
    Short_Text4 STRING(255),
    upload_customer_csv STRING(1024),
    upload_customer_csv_name STRING(255),
    user_to_accounts STRING(36),
) PRIMARY KEY (recordId)

When I run the following query:

SELECT `root`.`account_created_on` as `field0`, `root`.`Short_Text` as `field1`, `root`.`Short_Text1` as `field2`, `root`.`account_CID` as `field3`, `root`.`recordId` as `recordId` FROM `accounts` AS root

My table has 17349 records

Occasionally (1 in 5) when I run this query using:

database.runStream(query)
	.on('error', function (err) {
		console.error(err);
		return reject(err);
	})
	.on('data', function (row) {
		let rowJSON = row.toJSON();
		if (!rowJSON.recordId || rowJSON.recordId.match(/^\d+$/)) {
			console.log('Worker '+process.pid+' Row: '+JSON.stringify(rowJSON));
			console.log(row);
		}
		records[rowJSON.recordId] = rowJSON;
	})
	.on('end', function () {
		return resolve(records);
	});

I will get rows that are missing the recordId and the values will be the wrong labels for example field1 will contain the data for field2

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: spannerIssues related to the googleapis/nodejs-spanner API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions