From ea3868848a66a3b7925e5c8485ce66fb99d73d19 Mon Sep 17 00:00:00 2001 From: Kaveh Vahedipour Date: Fri, 31 Jan 2025 07:42:44 +0100 Subject: [PATCH 1/3] add time fields --- feeds/graph.feed | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/feeds/graph.feed b/feeds/graph.feed index 833472d..f2be9d1 100644 --- a/feeds/graph.feed +++ b/feeds/graph.feed @@ -1,8 +1,8 @@ [ graph create name=G vertexColl=V edgeColl=E numberOfShards=3 replicationFactor=2 drop=true -graph insertVertices name=G type=cyclic graphSize=10 vertexColl=V size=1K parallelism=1 -graph insertEdges name=G type=cyclic graphSize=10 vertexColl=V edgeColl=E size=1K parallelism=1 +graph insertVertices name=G type=cyclic graphSize=10000 vertexColl=V size=1K parallelism=1 withGeo=true withWords=5 documentSize=4096 +graph insertEdges name=G type=cyclic graphSize=10000 vertexColl=V edgeColl=E size=1K parallelism=1 graph create name=GG vertexColl=VV edgeColl=EE numberOfShards=3 replicationFactor=2 drop=true -graph insertVertices name=GG type=tree graphDepth=4 vertexColl=VV size=1K parallelism=1 -graph insertEdges name=GG type=tree graphDepth=4 vertexColl=VV edgeColl=EE size=1K parallelism=1 +graph insertVertices name=GG type=tree graphSize=10000 vertexColl=VV size=1K parallelism=1 withGeo=true withWords=20 +graph insertEdges name=GG type=tree graphSize=10000 graphDepth=16 vertexColl=VV edgeColl=EE size=1K parallelism=1 ] From 32c918dfee68fa83ba6b5ffe5a8a2d0ced633db5 Mon Sep 17 00:00:00 2001 From: Kaveh Vahedipour Date: Fri, 31 Jan 2025 07:45:57 +0100 Subject: [PATCH 2/3] add time fields --- feeds/graph.feed | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/feeds/graph.feed b/feeds/graph.feed index f2be9d1..833472d 100644 --- a/feeds/graph.feed +++ b/feeds/graph.feed @@ -1,8 +1,8 @@ [ graph create name=G vertexColl=V edgeColl=E numberOfShards=3 replicationFactor=2 drop=true -graph insertVertices name=G type=cyclic graphSize=10000 vertexColl=V size=1K parallelism=1 withGeo=true withWords=5 documentSize=4096 -graph insertEdges name=G type=cyclic graphSize=10000 vertexColl=V edgeColl=E size=1K parallelism=1 +graph insertVertices name=G type=cyclic graphSize=10 vertexColl=V size=1K parallelism=1 +graph insertEdges name=G type=cyclic graphSize=10 vertexColl=V edgeColl=E size=1K parallelism=1 graph create name=GG vertexColl=VV edgeColl=EE numberOfShards=3 replicationFactor=2 drop=true -graph insertVertices name=GG type=tree graphSize=10000 vertexColl=VV size=1K parallelism=1 withGeo=true withWords=20 -graph insertEdges name=GG type=tree graphSize=10000 graphDepth=16 vertexColl=VV edgeColl=EE size=1K parallelism=1 +graph insertVertices name=GG type=tree graphDepth=4 vertexColl=VV size=1K parallelism=1 +graph insertEdges name=GG type=tree graphDepth=4 vertexColl=VV edgeColl=EE size=1K parallelism=1 ] From be55b589ba3da9e0e5ff885776076f021b5cd7ff Mon Sep 17 00:00:00 2001 From: Kaveh Vahedipour Date: Fri, 31 Jan 2025 07:47:04 +0100 Subject: [PATCH 3/3] add time fields --- pkg/datagen/datagen.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/datagen/datagen.go b/pkg/datagen/datagen.go index b63869b..213d672 100644 --- a/pkg/datagen/datagen.go +++ b/pkg/datagen/datagen.go @@ -5,6 +5,7 @@ import ( "fmt" "math/rand" "strconv" + "time" ) var ( @@ -204,6 +205,7 @@ type Doc struct { // For edges only, the Label of the from vertex FromLabel string `json:"fromId,omitempty"` // For edges only, the Label of the to vertex + ToLabel string `json:"toId,omitempty"` Payload0 string `json:"payload0"` Payload1 string `json:"payload1,omitempty"` @@ -223,6 +225,9 @@ type Doc struct { Payloadf string `json:"payloadf,omitempty"` Geo *Poly `Json:"geo,omitempty"` Words string `json:"words,omitempty"` + + Created int64 `json:"created,omitempty"` + Expired int64 `json:"expired,omitempty"` } // makeRandomPolygon makes a random GeoJson polygon. @@ -318,17 +323,23 @@ type DocumentConfig struct { } func (doc *Doc) FillData(docConfig *DocumentConfig, source *rand.Rand) { + rand.Seed(time.Now().UnixNano()) + min := 3600 + max := 604800 + if docConfig.NumberFields > 16 { docConfig.NumberFields = 16 } else if docConfig.NumberFields < 1 { docConfig.NumberFields = 1 } - payloadSize := (docConfig.SizePerDoc - docConfig.KeySize - 106 - 11*docConfig.WithWords) / docConfig.NumberFields + payloadSize := (docConfig.SizePerDoc - docConfig.KeySize - 106 - 11*docConfig.WithWords + 34) / docConfig.NumberFields // 106 is the approximate overhead for _id, _rev and structures if payloadSize < 0 { - payloadSize = int64(5) + payloadSize = int64(16) } doc.Payload0 = MakeRandomStringWithSpaces(int(payloadSize), source) + doc.Created = time.Now().Unix() - int64(rand.Intn(max-min+1)+min) + doc.Expired = doc.Created + 3600 if docConfig.WithGeo { doc.Geo = makeRandomPolygon(source) }