Skip to content

Commit 60b6801

Browse files
committed
feat(Spanner): multiplexed sessions
1 parent bfc0dd6 commit 60b6801

83 files changed

Lines changed: 2538 additions & 5201 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/emulator-system-tests-spanner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
php-version: '8.1'
4545
ini-values: grpc.enable_fork_support=1
4646
tools: pecl
47-
extensions: bcmath, grpc
47+
extensions: bcmath, grpc, pcntl
4848

4949
- name: Install dependencies
5050
run: |

Core/src/Testing/Snippet/SnippetTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
*/
3333
class SnippetTestCase extends TestCase
3434
{
35+
const PROJECT = 'my-awesome-project';
36+
3537
use CheckForClassTrait;
3638

3739
private static $coverage;

Core/src/Testing/System/SystemTestCase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Google\Cloud\Storage\StorageClient;
2929
use Google\Cloud\Core\Testing\System\DeletionQueue;
3030
use PHPUnit\Framework\TestCase;
31+
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
3132

3233
/**
3334
* SystemTestCase can be extended to implement system tests
@@ -286,4 +287,11 @@ public static function skipIfEmulatorUsed($reason = null)
286287
self::markTestSkipped($reason ?: 'This test is not supported by the emulator.');
287288
}
288289
}
290+
291+
protected static function getCacheItemPool()
292+
{
293+
return new FilesystemAdapter(
294+
directory: __DIR__ . '/../../../../.cache'
295+
);
296+
}
289297
}

Core/tests/Unit/Batch/OpisClosureSerializerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
/**
2626
* @group core
2727
* @group batch
28+
* @runTestsInSeparateProcesses
2829
*/
2930
class OpisClosureSerializerTest extends TestCase
3031
{
3132
public function testWrapAndUnwrapClosures()
3233
{
33-
if (!method_exists(SerializableClosure::class, 'enterContext')) {
34+
if (!@method_exists(SerializableClosure::class, 'enterContext')) {
3435
$this->markTestSkipped('Requires ops/serializer:v3');
3536
}
3637

@@ -49,8 +50,8 @@ public function testWrapAndUnwrapClosures()
4950

5051
public function testWrapAndUnwrapClosuresV4()
5152
{
52-
if (!function_exists('Opis\Closure\serialize')) {
53-
$this->markTestSkipped('Requires ops/serializer:v3');
53+
if (@method_exists(SerializableClosure::class, 'enterContext')) {
54+
$this->markTestSkipped('Requires ops/serializer:v4');
5455
}
5556

5657
$data['closure'] = function () {

Core/tests/Unit/Lock/FlockLockTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* @group core
2727
* @group lock
28+
* @runTestsInSeparateProcesses
2829
*/
2930
class FlockLockTest extends TestCase
3031
{

Core/tests/Unit/Lock/SemaphoreLockTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
/**
2727
* @group core
2828
* @group lock
29+
* @runTestsInSeparateProcesses
2930
*/
3031
class SemaphoreLockTest extends TestCase
3132
{

Datastore/tests/Snippet/FilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FilterTest extends SnippetTestCase
2424
use ProphecyTrait;
2525
use ProtoEncodeTrait;
2626

27-
private const PROJECT = 'alpha-project';
27+
const PROJECT = 'alpha-project';
2828
private $gapicClient;
2929
private $datastore;
3030
private $operation;

PubSub/tests/Snippet/PubSubClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PubSubClientTest extends SnippetTestCase
4343
{
4444
use ProphecyTrait;
4545

46-
private const PROJECT_ID = 'my-awesome-project';
46+
const PROJECT_ID = 'my-awesome-project';
4747
private const TOPIC = 'projects/my-awesome-project/topics/my-new-topic';
4848
private const SUBSCRIPTION = 'projects/my-awesome-project/subscriptions/my-new-subscription';
4949
private const SNAPSHOT = 'projects/my-awesome-project/snapshots/my-snapshot';

PubSub/tests/Snippet/SnapshotTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SnapshotTest extends SnippetTestCase
3838
use ProphecyTrait;
3939
use ApiHelperTrait;
4040

41-
private const PROJECT = 'my-awesome-project';
41+
const PROJECT = 'my-awesome-project';
4242
private const SNAPSHOT = 'projects/my-awesome-project/snapshots/my-snapshot';
4343
private const PROJECT_ID = 'my-awesome-project';
4444

Spanner/MIGRATING.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,20 @@ $lro->delete();
117117
### Removed Methods
118118

119119
- `Operation::createTransaction` => use `Operation::transaction` instead
120-
- `Operation::createSnapshot` => use `Operation::snapshot` instead
120+
- `Operation::createSnapshot` => use `Operation::snapshot` instead
121+
- `Database::close` => obsolete
122+
- `Database::sessionPool` => obsolete
123+
- `Database::batchCreateSessions` => obsolete
124+
- `Database::deleteSessionAsync` => obsolete
125+
- `BatchSnapshot::close` => obsolete
126+
- `Operation::session` => obsolete
127+
- `Operation::createSession` => (obsolete)
128+
- `Operation::commitWithResponse` (obsolete) => use `Operation::commit` instead
129+
130+
### Removed Classes
131+
132+
- `Session\Session` => removed in favor of `SessionCache`
133+
- `Session\CacheSessionPool` => removed in favor of `SessionCache`
134+
- `Session\SessionPoolInterface` => removed in favor of `SessionCache`
135+
- `Operation` - this class is marked `@internal`, and should not be used directly.
136+

0 commit comments

Comments
 (0)