Merge pull request #1719 from 54mir/54mir/log-roaring-migrate

CORE-874 Add darwin build to roaring-migrate-tool
This commit is contained in:
Samir Patel 2021-10-01 10:35:22 -05:00 committed by GitHub
commit 231e11ffe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 3 deletions

View file

@ -0,0 +1,27 @@
// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build darwin
package main
import (
"syscall"
)
func CTimeNano(stat *syscall.Stat_t) int64 {
NANOS := int64(1e9) // number of nanosecs in 1 sec
ts := stat.Ctimespec
return ts.Sec*NANOS + ts.Nsec
}

View file

@ -0,0 +1,25 @@
// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build linux
package main
import (
"syscall"
)
func CTimeNano(stat *syscall.Stat_t) int64 {
return stat.Ctim.Nano()
}

View file

@ -24,7 +24,7 @@ import (
"strings"
"syscall"
"github.com/molecula/featurebase/v2"
pilosa "github.com/molecula/featurebase/v2"
"github.com/molecula/featurebase/v2/rbf"
"github.com/molecula/featurebase/v2/rbf/cfg"
"github.com/molecula/featurebase/v2/roaring"
@ -148,7 +148,7 @@ func BuildSchema(dataDir string) ([]byte, error) {
l = &local{
Name: index,
Fields: make([]*pilosa.FieldInfo, 0),
CreatedAt: uint64(stat.Ctim.Nano()),
CreatedAt: uint64(CTimeNano(stat)),
Options: *io,
}
//index options
@ -158,7 +158,7 @@ func BuildSchema(dataDir string) ([]byte, error) {
field := t[2]
if field != "_exists" {
fi, err := pilosa.UnmarshalFieldOptions(field, stat.Ctim.Nano(), content)
fi, err := pilosa.UnmarshalFieldOptions(field, CTimeNano(stat), content)
if err != nil {
return err
}