etcd-io / zetcd

Serve the Apache Zookeeper API but back it with an etcd cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mtime and Ctime off by a factor of 1000

edgao opened this issue · comments

When I use zookeeper's zkCli.sh utility to interact with zetcd, the creation and modification timestamps of each node are off by 1000. For example, this node was created just before 5PM today, but the timestamp is set nearly 49,000 years in the future:

[zk: zetcd.etcd.svc.cluster.local(CONNECTED) 8] get /daemons
null
cZxid = 0x5
ctime = Wed Jan 21 12:59:52 PST 50995
mZxid = 0x5
mtime = Wed Jan 21 12:59:52 PST 50995
pZxid = 0x7
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1

Jan 21 12:59:52 PST 50995 is unix epoch 1547081413192; dividing that by a thousand yields 1547081413, which converts to January 9 16:50:13 PST 2019 as expected.

I'm running zetcd 0.0.5 and etcd 3.2.3; zkCli is v3.4.10

(I think the fix here is to divide ctime and mtime by 1000 in stat.go:46,52, so I'll go ahead and make a PR for that - let me know if that's an incorrect assumption, I'm new to both go and zetcd)

Confirming that this is now resolved:

[zk: zetcd.etcd.svc.cluster.local(CONNECTED) 2] get /daemons
null
cZxid = 0x5
ctime = Wed Jan 09 16:50:13 PST 2019
mZxid = 0x5
mtime = Wed Jan 09 16:50:13 PST 2019
pZxid = 0x7
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1

Thanks!