Skip to content

Instantly share code, notes, and snippets.

@tsuna
Last active August 29, 2015 14:27
Show Gist options
  • Save tsuna/e1c6339d6872f39e3cb4 to your computer and use it in GitHub Desktop.
Save tsuna/e1c6339d6872f39e3cb4 to your computer and use it in GitHub Desktop.
gohbase integration test to access a disabled table
func TestDisabledTable(t *testing.T) {
// TODO: We leak the master client.
master := gohbase.NewClient(*host, gohbase.Admin())
logrus.WithFields(logrus.Fields{"table": table}).Info("Disabling table")
_, err := master.SendRPC(hrpc.NewDisableTable(context.Background(), []byte(table)))
if err != nil {
t.Fatalf("Failed to disable %q: %s", table, err)
}
key := "TestDisabledTable"
c := gohbase.NewClient(*host)
headers := map[string][]string{"cf": nil}
get, err := hrpc.NewGetStr(context.Background(), table, key, hrpc.Families(headers))
logrus.WithFields(logrus.Fields{"table": table}).Info("Trying to access table")
_, err = c.SendRPC(get)
if err != nil {
t.Errorf("Get returned an error: %v", err)
}
logrus.WithFields(logrus.Fields{"table": table}).Info("Enabling table")
_, err = master.SendRPC(hrpc.NewEnableTable(context.Background(), []byte(table)))
if err != nil {
t.Fatalf("Failed to enable %q: %s", table, err)
}
}
=== RUN TestDisabledTable
INFO[0007] Disabling table table=test1
INFO[0007] Region is unavailable region=*regioninfo.Info{Table: "", RegionName: "", StopKey: ""}
INFO[0007] Looking up region host= port=0 region=*regioninfo.Info{Table: "", RegionName: "", StopKey: ""}
INFO[0007] Looking up region host=localhost port=51610 region=*regioninfo.Info{Table: "", RegionName: "", StopKey: ""}
INFO[0007] Region is available region=*regioninfo.Info{Table: "", RegionName: "", StopKey: ""}
INFO[0007] Trying to access table table=test1
INFO[0007] Region is unavailable region=*regioninfo.Info{Table: "hbase:meta", RegionName: "hbase:meta,,1", StopKey: ""}
INFO[0007] Looking up region host= port=0 region=*regioninfo.Info{Table: "hbase:meta", RegionName: "hbase:meta,,1", StopKey: ""}
INFO[0007] Looking up region host=localhost port=51612 region=*regioninfo.Info{Table: "hbase:meta", RegionName: "hbase:meta,,1", StopKey: ""}
INFO[0007] Region is available region=*regioninfo.Info{Table: "hbase:meta", RegionName: "hbase:meta,,1", StopKey: ""}
INFO[0007] parsing meta entry row=result:<cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"regioninfo" timestamp:1439106232069 cell_type:PUT value:"PBUF\010\311\335\251\213\361)\022\020\n\007default\022\005test1\032\000\"\000(\0000\0008\000" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"seqnumDuringOpen" timestamp:1439106232124 cell_type:PUT value:"\000\000\000\000\000\000\000\002" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"server" timestamp:1439106232124 cell_type:PUT value:"localhost:51612" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"serverstartcode" timestamp:1439106232124 cell_type:PUT value:"\000\000\001O\017\347\354\036" > stale:false >
INFO[0007] de-serialized pb proto=region_id:1439106232009 table_name:<namespace:"default" qualifier:"test1" > start_key:"" end_key:"" offline:false
INFO[0007] Region is unavailable region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
INFO[0007] Looking up region host=localhost port=51612 region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
INFO[0007] Region is available region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
WARN[0007] HBase Java exception org.apache.hadoop.hbase.NotServingRegionException:
org.apache.hadoop.hbase.NotServingRegionException: Region test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d. is not online on localhost,51612,1439080901662
at org.apache.hadoop.hbase.regionserver.HRegionServer.getRegionByEncodedName(HRegionServer.java:2749)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.getRegion(RSRpcServices.java:875)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.get(RSRpcServices.java:1725)
at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:31439)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2031)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:107)
at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:130)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:107)
at java.lang.Thread.run(Thread.java:744)
INFO[0007] Region is unavailable region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
INFO[0007] Looking up region host= port=0 region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
INFO[0007] parsing meta entry row=result:<cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"regioninfo" timestamp:1439106232069 cell_type:PUT value:"PBUF\010\311\335\251\213\361)\022\020\n\007default\022\005test1\032\000\"\000(\0000\0008\000" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"seqnumDuringOpen" timestamp:1439106232124 cell_type:PUT value:"\000\000\000\000\000\000\000\002" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"server" timestamp:1439106232124 cell_type:PUT value:"localhost:51612" > cell:<row:"test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d." family:"info" qualifier:"serverstartcode" timestamp:1439106232124 cell_type:PUT value:"\000\000\001O\017\347\354\036" > stale:false >
INFO[0007] de-serialized pb proto=region_id:1439106232009 table_name:<namespace:"default" qualifier:"test1" > start_key:"" end_key:"" offline:false
INFO[0007] Looking up region host=localhost port=51612 region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
INFO[0007] Region is available region=*regioninfo.Info{Table: "test1", RegionName: "test1,,1439106232009.55b069029d91d3daf145af1ec8b4a71d.", StopKey: ""}
panic: test timed out after 30s
goroutine 45 [running]:
testing.func·008()
/usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:681 +0x12f
created by time.goFunc
/usr/local/Cellar/go/1.4.2/libexec/src/time/sleep.go:129 +0x4b
goroutine 1 [chan receive]:
testing.RunTests(0x363fb0, 0x448a40, 0xd, 0xd, 0xc208394401)
/usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:556 +0xad6
testing.(*M).Run(0xc208048190, 0x9)
/usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:485 +0x6c
command-line-arguments_test.TestMain(0xc208048190)
/Users/tsuna/go/src/github.com/tsuna/gohbase/integration_test.go:35 +0xfc
main.main()
command-line-arguments/_test/_testmain.go:78 +0x1d1
goroutine 15 [select]:
github.com/tsuna/gohbase.(*Client).sendRPCToRegion(0xc208072300, 0x614998, 0xc2080108c0, 0xc208395110, 0x0, 0x0, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:451 +0x45f
github.com/tsuna/gohbase.(*Client).sendRPC(0xc208072300, 0x614998, 0xc2080108c0, 0x0, 0x0, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:352 +0x12e
github.com/tsuna/gohbase.(*Client).sendRPCToRegion(0xc208072300, 0x614998, 0xc2080108c0, 0xc208395110, 0x0, 0x0, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:453 +0x3a6
github.com/tsuna/gohbase.(*Client).findRegionForRPC(0xc208072300, 0x614998, 0xc2080108c0, 0x0, 0x0, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:516 +0x60f
github.com/tsuna/gohbase.(*Client).sendRPC(0xc208072300, 0x614998, 0xc2080108c0, 0x0, 0x0, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:354 +0x17a
github.com/tsuna/gohbase.(*Client).SendRPC(0xc208072300, 0x614998, 0xc2080108c0, 0x1, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/client.go:335 +0x5d
command-line-arguments_test.TestDisabledTable(0xc20802e2d0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/integration_test.go:126 +0xa64
testing.tRunner(0xc20802e2d0, 0x448a70)
/usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0xbf
created by testing.RunTests
/usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:555 +0xa8b
goroutine 14 [IO wait]:
net.(*pollDesc).Wait(0xc208010840, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208010840, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2080107e0, 0xc20802ac20, 0x4, 0x4, 0x0, 0x611b30, 0xc20802b188)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20803e038, 0xc20802ac20, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/net.go:121 +0xdc
github.com/tsuna/gohbase/region.(*Client).readFully(0xc20802e000, 0xc20802ac20, 0x4, 0x4, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:341 +0x8f
github.com/tsuna/gohbase/region.(*Client).receiveRpcs(0xc20802e000)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:223 +0x94
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:136 +0x5fc
goroutine 13 [select]:
github.com/tsuna/gohbase/region.(*Client).processRpcs(0xc20802e000)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:164 +0x752
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:135 +0x5e2
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
goroutine 25 [IO wait]:
net.(*pollDesc).Wait(0xc208010300, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208010300, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2080102a0, 0xc20802ab28, 0x4, 0x4, 0x0, 0x611b30, 0xc20802ad50)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20803e048, 0xc20802ab28, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/net.go:121 +0xdc
github.com/tsuna/gohbase/region.(*Client).readFully(0xc20802e1b0, 0xc20802ab28, 0x4, 0x4, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:341 +0x8f
github.com/tsuna/gohbase/region.(*Client).receiveRpcs(0xc20802e1b0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:223 +0x94
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:136 +0x5fc
goroutine 24 [select]:
github.com/tsuna/gohbase/region.(*Client).processRpcs(0xc20802e1b0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:164 +0x752
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:135 +0x5e2
goroutine 34 [IO wait]:
net.(*pollDesc).Wait(0xc208010a00, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208010a00, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2080109a0, 0xc20802abd8, 0x4, 0x4, 0x0, 0x611b30, 0xc20802bf18)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20803e060, 0xc20802abd8, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/net.go:121 +0xdc
github.com/tsuna/gohbase/region.(*Client).readFully(0xc20802e360, 0xc20802abd8, 0x4, 0x4, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:341 +0x8f
github.com/tsuna/gohbase/region.(*Client).receiveRpcs(0xc20802e360)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:223 +0x94
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:136 +0x5fc
goroutine 33 [select]:
github.com/tsuna/gohbase/region.(*Client).processRpcs(0xc20802e360)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:164 +0x752
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:135 +0x5e2
goroutine 46 [runnable]:
golang.org/x/net/context.func·004()
/Users/tsuna/go/src/golang.org/x/net/context/context.go:369
created by time.goFunc
/usr/local/Cellar/go/1.4.2/libexec/src/time/sleep.go:129 +0x4b
goroutine 37 [select]:
github.com/tsuna/gohbase/region.(*Client).processRpcs(0xc20802e510)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:164 +0x752
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:135 +0x5e2
goroutine 38 [IO wait]:
net.(*pollDesc).Wait(0xc2083953a0, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2083953a0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc208395340, 0xc20802b9d8, 0x4, 0x4, 0x0, 0x611b30, 0xc20802bb28)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20803e0a8, 0xc20802b9d8, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/net.go:121 +0xdc
github.com/tsuna/gohbase/region.(*Client).readFully(0xc20802e510, 0xc20802b9d8, 0x4, 0x4, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:341 +0x8f
github.com/tsuna/gohbase/region.(*Client).receiveRpcs(0xc20802e510)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:223 +0x94
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:136 +0x5fc
goroutine 41 [select]:
github.com/tsuna/gohbase/region.(*Client).processRpcs(0xc20802e750)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:164 +0x752
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:135 +0x5e2
goroutine 42 [IO wait]:
net.(*pollDesc).Wait(0xc208395cd0, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208395cd0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc208395c70, 0xc20855c5c8, 0x4, 0x4, 0x0, 0x611b30, 0xc20855c5e0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20803e0f0, 0xc20855c5c8, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/net.go:121 +0xdc
github.com/tsuna/gohbase/region.(*Client).readFully(0xc20802e750, 0xc20855c5c8, 0x4, 0x4, 0x0, 0x0)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:341 +0x8f
github.com/tsuna/gohbase/region.(*Client).receiveRpcs(0xc20802e750)
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:223 +0x94
created by github.com/tsuna/gohbase/region.NewClient
/Users/tsuna/go/src/github.com/tsuna/gohbase/region/client.go:136 +0x5fc
exit status 2
FAIL command-line-arguments 37.110s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment