Skip to content

Commit

Permalink
Fix license and lint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
borismartinovic01 committed Jan 13, 2025
1 parent 6ae736b commit 2b8f21d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
17 changes: 17 additions & 0 deletions scripts/docker/pg-dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Licensed to the 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. The 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.
#
FROM postgres:16

RUN apt-get update && apt-get install -y \
Expand Down
20 changes: 20 additions & 0 deletions scripts/docker/pg-init-scripts/init.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
* Licensed to the 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. The 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.
*
*/

CREATE TABLE locks (
name TEXT PRIMARY KEY,
leaderID TEXT NOT NULL
Expand Down
10 changes: 9 additions & 1 deletion store/engine/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ func New(id string, cfg *Config) (*Postgresql, error) {
lockReleaseCh: make(chan bool),
leaderChangeCh: make(chan bool),
}
err = p.initLeaderId()
if err != nil {
return nil, err
}
p.isReady.Store(false)
p.wg.Add(2)
p.initLeaderId()
go p.electLoop()
go p.observeLeaderEvent()
return p, nil
Expand Down Expand Up @@ -207,6 +210,11 @@ func (p *Postgresql) List(ctx context.Context, prefix string) ([]engine.Entry, e
Value: value,
})
}

if err := rows.Err(); err != nil {
return nil, err
}

return entries, nil
}

Expand Down

0 comments on commit 2b8f21d

Please sign in to comment.