-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't return all rows, only the first "package" #7311
Comments
@saranshdhingra FYI |
Hi @ser-sergeev We have tried fetching about 1M rows and then iterating over the results(to invoke the generator) but we don't see any issues. Thank you for supplying your code snippet. Can you also post the shema of the table you are querying on. Thanks. |
create table users
(
hash BYTES(32)
); The problem 100% exists. It can be proved by code. public function responses()
{
$batch = [OP_RECV_MESSAGE => true];
if ($this->metadata === null) {
$batch[OP_RECV_INITIAL_METADATA] = true;
}
$read_event = $this->call->startBatch($batch);
if ($this->metadata === null) {
$this->metadata = $read_event->metadata;
}
$response = $read_event->message;
while ($response !== null) {
yield $this->_deserializeResponse($response);
$response = $this->call->startBatch([
OP_RECV_MESSAGE => true,
])->message;
}
} Here we have public function rows($format = self::RETURN_ASSOCIATIVE)
{
$bufferedResults = [];
$call = $this->call;
$shouldRetry = false;
$isResultsYielded = false;
$valid = $this->createGenerator();
while ($valid) {
try {
$result = $this->generator->current();
$bufferedResults[] = $result;
$this->setResultData($result, $format);
$empty = false;
if (!isset($result['values']) || $this->columnCount === 0) {
$empty = true;
}
$hasResumeToken = $this->isSetAndTrue($result, 'resumeToken');
if ($hasResumeToken || count($bufferedResults) >= self::BUFFER_RESULT_LIMIT) {
$chunkedResult = null;
if (!$empty) {
list($yieldableRows, $chunkedResult) = $this->parseRowsFromBufferedResults($bufferedResults);
foreach ($yieldableRows as $row) {
$isResultsYielded = true;
yield $this->mapper->decodeValues($this->columns, $row, $format);
}
}
....
}
// retry without resume token when results have not yielded
$shouldRetry = !$isResultsYielded || $hasResumeToken;
$this->generator->next();
$valid = $this->generator->valid();
} catch (ServiceException $ex) {
....
}
}
...
} columnCount would be zero and on the generator wouldn't be any new rows, expect that came from first batch. And my patch that I put above would fix it this issue. I use metadata from first batch for next batches without metadata. This code runs at every new batches, and because of there wiuldn't be any metadata the code above would skip that batch.
|
@saranshdhingra Do you have any plans to fix it? |
Hi @ser-sergeev I can also confirm that your code changes in This is also evident from the fact that the presence of I think I have found a solution which is related to the changes made in |
The PR is merged, so we should expect this fix in the next release. Closing this issue for now, but please feel to reopen this if this issue or something similar persists. |
I don't know the exact size of "package", but when I'm reading more that 50k it doesn't return all result, only ~22k in my case.
I tried to read 500 million and I saw on a network monitoring that the data is coming but on a cycle I've got only first 22k.
On version google/cloud-spanner: 1.75.0 that problem doesn't exist.
It is breaking current working projects.
Environment details
Steps to reproduce
Code example
@taka-oyama сould you please look at this too
The text was updated successfully, but these errors were encountered: