fix wrong column family

This commit is contained in:
Chris Lu 2020-12-23 23:23:05 -08:00
parent 32955b04b8
commit c4a202ec41
2 changed files with 3 additions and 5 deletions

View file

@ -22,7 +22,6 @@ type HbaseStore struct {
table []byte table []byte
cfKv string cfKv string
cfMetaDir string cfMetaDir string
cfFlatDir string
column string column string
} }
@ -42,7 +41,6 @@ func (store *HbaseStore) initialize(zkquorum, table string) (err error) {
store.table = []byte(table) store.table = []byte(table)
store.cfKv = "kv" store.cfKv = "kv"
store.cfMetaDir = "meta" store.cfMetaDir = "meta"
store.cfFlatDir = "flat"
store.column = "a" store.column = "a"
// check table exists // check table exists
@ -59,7 +57,7 @@ func (store *HbaseStore) initialize(zkquorum, table string) (err error) {
// create table // create table
adminClient := gohbase.NewAdminClient(zkquorum) adminClient := gohbase.NewAdminClient(zkquorum)
cFamilies := []string{store.cfKv, store.cfMetaDir, store.cfFlatDir} cFamilies := []string{store.cfKv, store.cfMetaDir}
cf := make(map[string]map[string]string, len(cFamilies)) cf := make(map[string]map[string]string, len(cFamilies))
for _, f := range cFamilies { for _, f := range cFamilies {
cf[f] = nil cf[f] = nil

View file

@ -22,7 +22,7 @@ func (store *HbaseStore) KvDelete(ctx context.Context, key []byte) (err error) {
} }
func (store *HbaseStore) doPut(ctx context.Context, cf string, key, value []byte) (err error) { func (store *HbaseStore) doPut(ctx context.Context, cf string, key, value []byte) (err error) {
values := map[string]map[string][]byte{store.cfKv: map[string][]byte{}} values := map[string]map[string][]byte{cf: map[string][]byte{}}
values[cf][COLUMN_NAME] = value values[cf][COLUMN_NAME] = value
putRequest, err := hrpc.NewPut(ctx, store.table, key, values) putRequest, err := hrpc.NewPut(ctx, store.table, key, values)
if err != nil { if err != nil {
@ -53,7 +53,7 @@ func (store *HbaseStore) doGet(ctx context.Context, cf string, key []byte) (valu
} }
func (store *HbaseStore) doDelete(ctx context.Context, cf string, key []byte) (err error) { func (store *HbaseStore) doDelete(ctx context.Context, cf string, key []byte) (err error) {
values := map[string]map[string][]byte{store.cfKv: map[string][]byte{}} values := map[string]map[string][]byte{cf: map[string][]byte{}}
values[cf][COLUMN_NAME] = nil values[cf][COLUMN_NAME] = nil
deleteRequest, err := hrpc.NewDel(ctx, store.table, key, values) deleteRequest, err := hrpc.NewDel(ctx, store.table, key, values)
if err != nil { if err != nil {