You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "HHoflittlefish777 (via GitHub)" <gi...@apache.org> on 2023/02/19 11:16:07 UTC

[GitHub] [skywalking-banyandb] HHoflittlefish777 opened a new pull request, #253: Write-ahead Logging interface

HHoflittlefish777 opened a new pull request, #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253

   Write-ahead Logging interface design.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] HHoflittlefish777 commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "HHoflittlefish777 (via GitHub)" <gi...@apache.org>.
HHoflittlefish777 commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1111589868


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   Use rotate api can return a segment detail,and user can get segment id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1112399760


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.
+type WAL interface {
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.

Review Comment:
   ```suggestion
   	// Read specified segment by SegmentID.
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.
+type WAL interface {
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)
+	// ReadAllSegments operation reads all segments.
+	ReadAllSegments() ([]*Segment, error)
+	// Rotate closes the open segment and opens a new one, returning the closed segment details.
+	Rotate() (*Segment, error)
+	// Delete the specified segment.
+	Delete(index int) error
+}
+
+// New creates a Log instance in the specified root directory.
+func New(_ string, _ *Options) (*WAL, error) {

Review Comment:
   ```suggestion
   func New(_ string, _ Options) (WAL, error) {
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.
+type WAL interface {
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.

Review Comment:
   ```suggestion
   	// Write a logging entity.
   	// It will return immediately when the data is written in the buffer,
   	// The returned function will be called when the entity is flushed on the persistent storage.
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.
+type WAL interface {
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)
+	// ReadAllSegments operation reads all segments.
+	ReadAllSegments() ([]*Segment, error)
+	// Rotate closes the open segment and opens a new one, returning the closed segment details.
+	Rotate() (*Segment, error)
+	// Delete the specified segment.
+	Delete(index int) error
+}
+
+// New creates a Log instance in the specified root directory.

Review Comment:
   ```suggestion
   // New creates a WAL instance in the specified path.
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.

Review Comment:
   ```suggestion
   // WAL denotes a Write-ahead logging. 
   // Modules who want their data reliable could write data to an instance of WAL. 
   // A WAL combines several segments, ingesting data on a single opened one. 
   // Rotating the WAL will create a new segment, marking it as opened and persisting previous segments on the disk.
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment interface{}
+
+// WAL includes exposed interfaces.
+type WAL interface {
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)
+	// ReadAllSegments operation reads all segments.

Review Comment:
   ```suggestion
   	// ReadAllSegments reads all segments sorted by their creation time in ascending order.
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   Would you add a method to Segment to return such ID? It's better to define a customized SegmentID type instead of an integer one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1112504373


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,54 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// SegmentID identity a segment in a WAL.

Review Comment:
   ```suggestion
   // SegmentID identifies a segment in a WAL.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1111520336


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.

Review Comment:
   ```suggestion
   // Segment allows reading underlying segments that hold WAl entities 
   ```
   



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Options for Write-ahead Logging.

Review Comment:
   ```suggestion
   // Options for creating Write-ahead Logging.
   ```
   



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   How can a user get the segment id?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily merged pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] HHoflittlefish777 commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "HHoflittlefish777 (via GitHub)" <gi...@apache.org>.
HHoflittlefish777 commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1111368902


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   Rotate can get detail of segment, index is the segment id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1111341734


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}

Review Comment:
   This should be an interface instead of a dedicated type.



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)
+	// ReadAllSegments operation reads all segments.
+	ReadAllSegments() ([]*Segment, error)
+	// Rotation closes the open segment and opens a new one, returning the closed segment details.
+	Rotation() (*Segment, error)

Review Comment:
   ```suggestion
   	Rotate() (*Segment, error)
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}

Review Comment:
   Does it implement the WAL interface? If that, make it unexported.



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {

Review Comment:
   ```suggestion
   // WAL includes exposed interfaces.
   type WAL interface {
   ```



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)

Review Comment:
   Could you transfer it to a package-scoped function? This way is a go conventional path to build a constructor.



##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   Where can we get the `index`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#issuecomment-1437915027

   > @hanahmily Do we release0.3.1 patch first? Or you plan to cherry pick and release?
   
   I will hold this PR for a while till 0.3.1 is released. I want to fix the flaky case before releasing it in case of some unrevealed bugs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #253: Write-ahead Logging interface

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#discussion_r1112405176


##########
pkg/wal/wal.go:
##########
@@ -0,0 +1,46 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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.
+
+// Package wal (Write-ahead logging) is an independent component to ensure data reliability.
+package wal
+
+// Log stands for a write-ahead logging instance.
+type Log struct{}
+
+// Options for Write-ahead Logging.
+type Options struct{}
+
+// Segment stands for a segment instance of Write-ahead log.
+type Segment struct{}
+
+// Wal include exposed interfaces.
+type Wal interface {
+	// New creates a Log instance in the specified root directory.
+	New(path string, opts *Options) (*Log, error)
+	// Write request to the WAL buffer.
+	// It will return synchronously when the request write in the WAL buffer,
+	// and trigger asynchronous callback when return when the buffer is flushed to disk successfully.
+	Write(data []byte) (func(), error)
+	// Read specified segment by index.
+	Read(index int) (*Segment, error)

Review Comment:
   here is an example, https://github.com/apache/skywalking-banyandb/blob/main/api/common/id.go#L31



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] codecov-commenter commented on pull request #253: Write-ahead Logging interface

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#issuecomment-1435961719

   # [Codecov](https://codecov.io/gh/apache/skywalking-banyandb/pull/253?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#253](https://codecov.io/gh/apache/skywalking-banyandb/pull/253?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (44c9e17) into [main](https://codecov.io/gh/apache/skywalking-banyandb/commit/4bccc794509c1d41fbc893022cc7fe50554daf07?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4bccc79) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@           Coverage Diff           @@
   ##             main     #253   +/-   ##
   =======================================
     Coverage   45.88%   45.88%           
   =======================================
     Files          87       87           
     Lines        8896     8896           
   =======================================
     Hits         4082     4082           
     Misses       4430     4430           
     Partials      384      384           
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] wu-sheng commented on pull request #253: Write-ahead Logging interface

Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #253:
URL: https://github.com/apache/skywalking-banyandb/pull/253#issuecomment-1437838664

   @hanahmily Do we release0.3.1 patch first? Or you plan to cherry pick and release?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org