@ -113,7 +113,7 @@ func Test_BloomClient_PutMeta(t *testing.T) {
"ignored-file-path-during-uploading" ,
) ,
expectedStorage : "folder-1" ,
expectedFilePath : "bloom/first-period-19621/tenantA/metas/ff-fff-1695272400000-1695276000000-aaa" ,
expectedFilePath : fmt . Sprintf ( "bloom/first-period-19621/tenantA/metas/%s-1695272400000-1695276000000-aaa" , v1 . NewBounds ( 0xff , 0xfff ) ) ,
} ,
"expected meta to be uploaded to the second folder" : {
source : createMetaEntity ( "tenantA" ,
@ -126,7 +126,7 @@ func Test_BloomClient_PutMeta(t *testing.T) {
"ignored-file-path-during-uploading" ,
) ,
expectedStorage : "folder-2" ,
expectedFilePath : "bloom/second-period-19625/tenantA/metas/c8-12c-1695600000000-1695603600000-bbb" ,
expectedFilePath : fmt . Sprintf ( "bloom/second-period-19625/tenantA/metas/%s-1695600000000-1695603600000-bbb" , v1 . NewBounds ( 200 , 300 ) ) ,
} ,
}
for name , data := range tests {
@ -169,7 +169,7 @@ func Test_BloomClient_DeleteMeta(t *testing.T) {
"ignored-file-path-during-uploading" ,
) ,
expectedStorage : "folder-1" ,
expectedFilePath : "bloom/first-period-19621/tenantA/metas/ff-fff-1695272400000-1695276000000-aaa" ,
expectedFilePath : fmt . Sprintf ( "bloom/first-period-19621/tenantA/metas/%s-1695272400000-1695276000000-aaa" , v1 . NewBounds ( 0xff , 0xfff ) ) ,
} ,
"expected meta to be delete from the second folder" : {
source : createMetaEntity ( "tenantA" ,
@ -182,7 +182,7 @@ func Test_BloomClient_DeleteMeta(t *testing.T) {
"ignored-file-path-during-uploading" ,
) ,
expectedStorage : "folder-2" ,
expectedFilePath : "bloom/second-period-19625/tenantA/metas/c8-12c-1695600000000-1695603600000-bbb" ,
expectedFilePath : fmt . Sprintf ( "bloom/second-period-19625/tenantA/metas/%s-1695600000000-1695603600000-bbb" , v1 . NewBounds ( 200 , 300 ) ) ,
} ,
}
for name , data := range tests {
@ -207,10 +207,10 @@ func Test_BloomClient_DeleteMeta(t *testing.T) {
func Test_BloomClient_GetBlocks ( t * testing . T ) {
bloomClient := createStore ( t )
fsNamedStores := bloomClient . storageConfig . NamedStores . Filesystem
firstBlockPath := "bloom/first-period-19621/tenantA/blooms/eeee-ffff/1695272400000-1695276000000-1"
firstBlockPath := fmt . Sprintf ( "bloom/first-period-19621/tenantA/blooms/%s/1695272400000-1695276000000-1" , v1 . NewBounds ( 0xeeee , 0xffff ) )
firstBlockFullPath := filepath . Join ( fsNamedStores [ "folder-1" ] . Directory , firstBlockPath )
firstBlockData := createBlockFile ( t , firstBlockFullPath )
secondBlockPath := "bloom/second-period-19624/tenantA/blooms/aaaa-bbbb/1695531600000-1695535200000-2"
secondBlockPath := fmt . Sprintf ( "bloom/second-period-19624/tenantA/blooms/%s/1695531600000-1695535200000-2" , v1 . NewBounds ( 0xaaaa , 0xbbbb ) )
secondBlockFullPath := filepath . Join ( fsNamedStores [ "folder-2" ] . Directory , secondBlockPath )
secondBlockData := createBlockFile ( t , secondBlockFullPath )
require . FileExists ( t , firstBlockFullPath )
@ -220,8 +220,7 @@ func Test_BloomClient_GetBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "first-period-19621" ,
MinFingerprint : 0xeeee ,
MaxFingerprint : 0xffff ,
Bounds : v1 . NewBounds ( 0xeeee , 0xffff ) ,
StartTimestamp : Date ( 2023 , time . September , 21 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 21 , 6 , 0 , 0 ) ,
Checksum : 1 ,
@ -232,8 +231,7 @@ func Test_BloomClient_GetBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "second-period-19624" ,
MinFingerprint : 0xaaaa ,
MaxFingerprint : 0xbbbb ,
Bounds : v1 . NewBounds ( 0xaaaa , 0xbbbb ) ,
StartTimestamp : Date ( 2023 , time . September , 24 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 24 , 6 , 0 , 0 ) ,
Checksum : 2 ,
@ -262,8 +260,7 @@ func Test_BloomClient_PutBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "first-period-19621" ,
MinFingerprint : 0xeeee ,
MaxFingerprint : 0xffff ,
Bounds : v1 . NewBounds ( 0xeeee , 0xffff ) ,
StartTimestamp : Date ( 2023 , time . September , 21 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 21 , 6 , 0 , 0 ) ,
Checksum : 1 ,
@ -279,8 +276,7 @@ func Test_BloomClient_PutBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "second-period-19624" ,
MinFingerprint : 0xaaaa ,
MaxFingerprint : 0xbbbb ,
Bounds : v1 . NewBounds ( 0xaaaa , 0xbbbb ) ,
StartTimestamp : Date ( 2023 , time . September , 24 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 24 , 6 , 0 , 0 ) ,
Checksum : 2 ,
@ -295,11 +291,17 @@ func Test_BloomClient_PutBlocks(t *testing.T) {
require . Len ( t , results , 2 )
firstResultBlock := results [ 0 ]
path := firstResultBlock . BlockPath
require . Equal ( t , "bloom/first-period-19621/tenantA/blooms/eeee-ffff/1695272400000-1695276000000-1" , path )
require . Equal ( t ,
fmt . Sprintf (
"bloom/first-period-19621/tenantA/blooms/%s/1695272400000-1695276000000-1" ,
v1 . NewBounds ( 0xeeee , 0xffff ) ,
) ,
path ,
)
require . Equal ( t , blockForFirstFolder . TenantID , firstResultBlock . TenantID )
require . Equal ( t , blockForFirstFolder . TableName , firstResultBlock . TableName )
require . Equal ( t , blockForFirstFolder . MinFingerprint , firstResultBlock . MinFingerprint )
require . Equal ( t , blockForFirstFolder . MaxFingerprint , firstResultBlock . MaxFingerprint )
require . Equal ( t , blockForFirstFolder . Bounds . Min , firstResultBlock . Bounds . Min )
require . Equal ( t , blockForFirstFolder . Bounds . Max , firstResultBlock . Bounds . Max )
require . Equal ( t , blockForFirstFolder . StartTimestamp , firstResultBlock . StartTimestamp )
require . Equal ( t , blockForFirstFolder . EndTimestamp , firstResultBlock . EndTimestamp )
require . Equal ( t , blockForFirstFolder . Checksum , firstResultBlock . Checksum )
@ -313,11 +315,17 @@ func Test_BloomClient_PutBlocks(t *testing.T) {
secondResultBlock := results [ 1 ]
path = secondResultBlock . BlockPath
require . Equal ( t , "bloom/second-period-19624/tenantA/blooms/aaaa-bbbb/1695531600000-1695535200000-2" , path )
require . Equal ( t ,
fmt . Sprintf (
"bloom/second-period-19624/tenantA/blooms/%s/1695531600000-1695535200000-2" ,
v1 . NewBounds ( 0xaaaa , 0xbbbb ) ,
) ,
path ,
)
require . Equal ( t , blockForSecondFolder . TenantID , secondResultBlock . TenantID )
require . Equal ( t , blockForSecondFolder . TableName , secondResultBlock . TableName )
require . Equal ( t , blockForSecondFolder . MinFingerprint , secondResultBlock . MinFingerprint )
require . Equal ( t , blockForSecondFolder . MaxFingerprint , secondResultBlock . MaxFingerprint )
require . Equal ( t , blockForSecondFolder . Bounds . Min , secondResultBlock . Bounds . Min )
require . Equal ( t , blockForSecondFolder . Bounds . Max , secondResultBlock . Bounds . Max )
require . Equal ( t , blockForSecondFolder . StartTimestamp , secondResultBlock . StartTimestamp )
require . Equal ( t , blockForSecondFolder . EndTimestamp , secondResultBlock . EndTimestamp )
require . Equal ( t , blockForSecondFolder . Checksum , secondResultBlock . Checksum )
@ -334,9 +342,9 @@ func Test_BloomClient_PutBlocks(t *testing.T) {
func Test_BloomClient_DeleteBlocks ( t * testing . T ) {
bloomClient := createStore ( t )
fsNamedStores := bloomClient . storageConfig . NamedStores . Filesystem
block1Path := filepath . Join ( fsNamedStores [ "folder-1" ] . Directory , "bloom/first-period-19621/tenantA/blooms/eeee-ffff/1695272400000-1695276000000-1" )
block1Path := filepath . Join ( fsNamedStores [ "folder-1" ] . Directory , "bloom/first-period-19621/tenantA/blooms/000000000000 eeee-000000000000 ffff/1695272400000-1695276000000-1" )
createBlockFile ( t , block1Path )
block2Path := filepath . Join ( fsNamedStores [ "folder-2" ] . Directory , "bloom/second-period-19624/tenantA/blooms/aaaa-bbbb/1695531600000-1695535200000-2" )
block2Path := filepath . Join ( fsNamedStores [ "folder-2" ] . Directory , "bloom/second-period-19624/tenantA/blooms/000000000000 aaaa-000000000000 bbbb/1695531600000-1695535200000-2" )
createBlockFile ( t , block2Path )
require . FileExists ( t , block1Path )
require . FileExists ( t , block2Path )
@ -346,8 +354,7 @@ func Test_BloomClient_DeleteBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "second-period-19624" ,
MinFingerprint : 0xaaaa ,
MaxFingerprint : 0xbbbb ,
Bounds : v1 . NewBounds ( 0xaaaa , 0xbbbb ) ,
StartTimestamp : Date ( 2023 , time . September , 24 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 24 , 6 , 0 , 0 ) ,
Checksum : 2 ,
@ -358,8 +365,7 @@ func Test_BloomClient_DeleteBlocks(t *testing.T) {
Ref : Ref {
TenantID : "tenantA" ,
TableName : "first-period-19621" ,
MinFingerprint : 0xeeee ,
MaxFingerprint : 0xffff ,
Bounds : v1 . NewBounds ( 0xeeee , 0xffff ) ,
StartTimestamp : Date ( 2023 , time . September , 21 , 5 , 0 , 0 ) ,
EndTimestamp : Date ( 2023 , time . September , 21 , 6 , 0 , 0 ) ,
Checksum : 1 ,
@ -399,8 +405,7 @@ func Test_createMetaRef(t *testing.T) {
Ref : Ref {
TenantID : "tenant1" ,
TableName : "table1" ,
MinFingerprint : 0xaaa ,
MaxFingerprint : 0xbbb ,
Bounds : v1 . NewBounds ( 0xaaa , 0xbbb ) ,
StartTimestamp : 1234567890 ,
EndTimestamp : 9876543210 ,
Checksum : 0xabcdef ,
@ -535,8 +540,7 @@ func createMetaEntity(
Ref : Ref {
TenantID : tenant ,
TableName : tableName ,
MinFingerprint : minFingerprint ,
MaxFingerprint : maxFingerprint ,
Bounds : v1 . NewBounds ( model . Fingerprint ( minFingerprint ) , model . Fingerprint ( maxFingerprint ) ) ,
StartTimestamp : startTimestamp ,
EndTimestamp : endTimestamp ,
Checksum : metaChecksum ,
@ -548,8 +552,7 @@ func createMetaEntity(
Ref : Ref {
TenantID : tenant ,
Checksum : metaChecksum + 1 ,
MinFingerprint : minFingerprint ,
MaxFingerprint : maxFingerprint ,
Bounds : v1 . NewBounds ( model . Fingerprint ( minFingerprint ) , model . Fingerprint ( maxFingerprint ) ) ,
StartTimestamp : startTimestamp ,
EndTimestamp : endTimestamp ,
} ,
@ -562,8 +565,7 @@ func createMetaEntity(
Ref : Ref {
TenantID : tenant ,
Checksum : metaChecksum + 2 ,
MinFingerprint : minFingerprint ,
MaxFingerprint : maxFingerprint ,
Bounds : v1 . NewBounds ( model . Fingerprint ( minFingerprint ) , model . Fingerprint ( maxFingerprint ) ) ,
StartTimestamp : startTimestamp ,
EndTimestamp : endTimestamp ,
} ,