You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cdbaeee
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(bigtable): introduce SessionKey/SessionPermission; merge SessionMap into SessionPoolMap
Add SessionPermission (READ/WRITE/READ_WRITE) and SessionKey<IdT> to
pair a target ID with a permission level, then absorb the three-map
registry logic directly into SessionPoolMap instead of a separate class.
SessionPoolMap now holds one LoadingCache per ID type
(TableId / AuthorizedViewId / MaterializedViewId), keyed by
SessionKey<IdT>. Two shim operations requesting the same (id,
permission) — e.g. a future CheckAndMutateRowShim and
ReadModifyWriteRowShim both using READ_WRITE on the same table — will
resolve to the same handle and therefore the same session pool.
Fix supports() to use getIfPresent() instead of get(). Previously
supports() called the loading get(), which would:
1. Open a session pool as a side effect of a cheap read-only check.
2. Throw IllegalStateException (Client is closed) unchecked through
DivertingUnaryCallable.useExperimental(), bypassing the normal
failed-future error surface.
With getIfPresent(), a null return (no pool yet) is treated as
"optimistically supported": the pool opens lazily in call(), and if
that fails (closed client, etc.) apply() surfaces it as a failed future.
ShimImpl creates a single shared SessionPoolMap and passes it to all
shims; each shim declares its required SessionPermission internally.
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/ShimImpl.java
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/Util.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,6 @@
25
25
importio.grpc.Context;
26
26
importio.grpc.Deadline;
27
27
importjava.io.Closeable;
28
-
importjava.io.IOException;
29
28
importjava.time.Duration;
30
29
importjava.util.Optional;
31
30
importjava.util.concurrent.TimeUnit;
@@ -46,7 +45,7 @@ public static <K, V extends Closeable> LoadingCache<K, V> createSessionMap(
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/ops/CheckAndMutateRowShim.java
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/ops/DivertingUnaryCallable.java
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/ops/MutateRowShim.java
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/compat/ops/ReadModifyWriteRowShim.java
0 commit comments