Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic index out of range when execute the function agent.GetFields #48

Open
fcddk opened this issue Nov 30, 2020 · 3 comments
Open

panic index out of range when execute the function agent.GetFields #48

fcddk opened this issue Nov 30, 2020 · 3 comments

Comments

@fcddk
Copy link

fcddk commented Nov 30, 2020

log:

time="2020-11-10 06:34:45" level=debug msg="discovered measurement &{\x18.�\x1b\x00\v� map[]} on DB: prometheus-RP:autogen"
time="2020-11-10 06:34:45" level=debug msg="get fields query[show field keys from "\x18.�\x1b\x00\v�"],db[prometheus],meas[\x18.�\x1b\x00\v�]"
time="2020-11-10 06:34:45" level=debug msg="get fields from meas[\x18.�\x1b\x00\v�], response:[[]]"
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/toni-moreno/syncflux/pkg/agent.GetFields(0xbee080, 0xc00038aa90, 0xc00039a870, 0xa, 0xc00012c890, 0xb, 0xc00002f9a7, 0x7, 0xc0002ae000)
/home/golang/src/github.com/toni-moreno/syncflux/pkg/agent/client.go:256 +0x8fc
github.com/toni-moreno/syncflux/pkg/agent.(*HACluster).GetSchema(0xc000120f70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xb58088, 0xc0001cdd60, ...)
/home/golang/src/github.com/toni-moreno/syncflux/pkg/agent/hacluster.go:147 +0x8ea
github.com/toni-moreno/syncflux/pkg/agent.HAMonitorStart(0xc00012c2a0, 0xa, 0xc00012c380, 0xa)
/home/golang/src/github.com/toni-moreno/syncflux/pkg/agent/agent.go:247 +0x9b
main.main()
/home/golang/src/github.com/toni-moreno/syncflux/pkg/main.go:296 +0x53b

@fcddk
Copy link
Author

fcddk commented Nov 30, 2020

code:
pkg/agent/client.go
if len(res[0].Series) == 0 {
log.Warnf("The response for Query is null, get Fields from DB %s Measurement %s error!\n", sdb, meas)
} else {

	values := res[0].Series[0].Values	
	//show progress of getting measurements	
	for _, row := range values {	
		fieldname := row[0].(string)	
		fieldtype := row[1].(string)	
		fields[fieldname] = &FieldSch{Name: fieldname, Type: fieldtype}	
		log.Debugf("Detected Field [%s] type [%s] on measurement [%s]", fieldname, fieldtype, meas)	
	}			}

}		}

return fields		return fields

}

fcddk referenced this issue in fcddk/syncflux Nov 30, 2020
@toni-moreno
Copy link
Owner

Hello @fcddk What version of influxdb are you trying to copy?

@fcddk
Copy link
Author

fcddk commented Dec 1, 2020

influxdb version: 1.8.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants