Skip to content

Commit 4ee5cbd

Browse files
committed
make table name unique
1 parent 9eb312c commit 4ee5cbd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bigtable/hbase/snippets/src/main/java/com/example/bigtable/HelloWorld.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.cloud.bigtable.hbase.BigtableConfiguration;
2121
import java.io.IOException;
2222
// [END bigtable_hw_imports_hbase]
23+
import java.util.UUID;
2324
import org.apache.hadoop.hbase.HColumnDescriptor;
2425
import org.apache.hadoop.hbase.HTableDescriptor;
2526
import org.apache.hadoop.hbase.TableName;
@@ -40,7 +41,7 @@
4041
public class HelloWorld {
4142

4243
// Refer to table metadata names by byte array in the HBase API
43-
private static final byte[] TABLE_NAME = Bytes.toBytes("Hello-Bigtable");
44+
private static final byte[] TABLE_NAME = Bytes.toBytes("Hello-Bigtable-" + UUID.randomUUID().toString().substring(0, 19));
4445
private static final byte[] COLUMN_FAMILY_NAME = Bytes.toBytes("cf1");
4546
private static final byte[] COLUMN_NAME = Bytes.toBytes("greeting");
4647

0 commit comments

Comments
 (0)