mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-25 05:37:12 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c48b407053 | ||
|
|
b78a2dc59b | ||
|
|
f7a45d448f | ||
|
|
c0283eee1a | ||
|
|
55b6efb755 | ||
|
|
0e7c1a300b | ||
|
|
320d70d305 | ||
|
|
546709c1de | ||
|
|
0e3b970c0c | ||
|
|
ae1994cbc1 | ||
|
|
ce79ec0bd4 | ||
|
|
222f93e816 | ||
|
|
b74eced7a3 | ||
|
|
a80bf29d4f | ||
|
|
f711e8dde4 | ||
|
|
b7afa9fd57 | ||
|
|
0ca4a6c4e6 | ||
|
|
7ccc31853c | ||
|
|
48880edc2c | ||
|
|
a0464fc267 | ||
|
|
0d1d83a5a5 | ||
|
|
00f96d86a1 | ||
|
|
63a1db64c5 | ||
|
|
283b749ff1 | ||
|
|
fafc41a27f | ||
|
|
2d2c5dfa39 | ||
|
|
628b27ef3b | ||
|
|
b9365de47b | ||
|
|
718052656a | ||
|
|
95a9686eaf | ||
|
|
c66f357715 | ||
|
|
03e8f976d9 | ||
|
|
c38066be89 | ||
|
|
4598473251 | ||
|
|
bb3e86fbd5 | ||
|
|
bdbe5ddbe9 | ||
|
|
b8e346cc86 | ||
|
|
45a9d852d3 | ||
|
|
03c2f03509 | ||
|
|
ebd1759741 | ||
|
|
2410ffbd79 | ||
|
|
0e0db70f55 | ||
|
|
393ab07c7c | ||
|
|
fbed2e9026 | ||
|
|
48f9ff52cf | ||
|
|
bc2ec6774d | ||
|
|
ea93d21641 | ||
|
|
1f8782a1ed | ||
|
|
1a642b9876 | ||
|
|
5837fe72fc | ||
|
|
b4e93b639d | ||
|
|
accb4964b7 | ||
|
|
6286a454c7 | ||
|
|
21d0a013d5 | ||
|
|
ed92992003 | ||
|
|
41cab5d69f | ||
|
|
73264b952b | ||
|
|
ef2b3a0801 | ||
|
|
5d3ec22975 | ||
|
|
d4235afe4d | ||
|
|
bf86e38f9a | ||
|
|
ecdeef8c66 | ||
|
|
16fc3fb1a0 | ||
|
|
8dfaaeabfd | ||
|
|
e5a0787653 | ||
|
|
ab4c9ac221 | ||
|
|
1e64dbcb98 | ||
|
|
232b0f0e6e | ||
|
|
49973333f2 | ||
|
|
857aa0de08 | ||
|
|
ed9e4dc749 | ||
|
|
7ff2b0121d |
No files matched your search
@@ -0,0 +1,37 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
cd weed; go get -v -t -d ./...
|
||||
if [ -f Gopkg.toml ]; then
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
dep ensure
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: cd weed; go build -v .
|
||||
|
||||
- name: Test
|
||||
run: cd weed; go test -v .
|
||||
@@ -1,4 +1,4 @@
|
||||
Apache License
|
||||
g Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
|
||||
@@ -8,11 +8,14 @@ appname := weed
|
||||
|
||||
sources := $(wildcard *.go)
|
||||
|
||||
build = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -ldflags "-extldflags -static" -o build/$(appname)$(3) $(SOURCE_DIR)
|
||||
COMMIT ?= $(shell git rev-parse --short HEAD)
|
||||
LDFLAGS ?= -X github.com/chrislusf/seaweedfs/weed/util.COMMIT=${COMMIT}
|
||||
|
||||
build = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -ldflags "-extldflags -static $(LDFLAGS)" -o build/$(appname)$(3) $(SOURCE_DIR)
|
||||
tar = cd build && tar -cvzf $(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
|
||||
zip = cd build && zip $(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
|
||||
|
||||
build_large = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -tags 5BytesOffset -ldflags "-extldflags -static" -o build/$(appname)$(3) $(SOURCE_DIR)
|
||||
build_large = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -tags 5BytesOffset -ldflags "-extldflags -static $(LDFLAGS)" -o build/$(appname)$(3) $(SOURCE_DIR)
|
||||
tar_large = cd build && tar -cvzf $(1)_$(2)_large_disk.tar.gz $(appname)$(3) && rm $(appname)$(3)
|
||||
zip_large = cd build && zip $(1)_$(2)_large_disk.zip $(appname)$(3) && rm $(appname)$(3)
|
||||
|
||||
@@ -31,11 +34,11 @@ deps:
|
||||
rm -rf /home/travis/gopath/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
|
||||
|
||||
build: deps
|
||||
go build $(GO_FLAGS) -o $(BINARY) $(SOURCE_DIR)
|
||||
go build $(GO_FLAGS) -ldflags "$(LDFLAGS)" -o $(BINARY) $(SOURCE_DIR)
|
||||
|
||||
linux: deps
|
||||
mkdir -p linux
|
||||
GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o linux/$(BINARY) $(SOURCE_DIR)
|
||||
GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -ldflags "$(LDFLAGS)" -o linux/$(BINARY) $(SOURCE_DIR)
|
||||
|
||||
release: deps windows_build darwin_build linux_build bsd_build 5_byte_linux_build 5_byte_darwin_build 5_byte_windows_build
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ On top of the object store, optional [Filer] can support directories and POSIX a
|
||||
* [WebDAV] access as a mapped drive on Mac and Windows, or from mobile devices.
|
||||
* [AES256-GCM Encrypted Storage][FilerDataEncryption] safely stores the encrypted data.
|
||||
* [File TTL][FilerTTL] automatically purge file metadata and actual file data.
|
||||
* [Kubernetes CSI Driver][SeaweedFsCsiDriver] A Container Storage Interface (CSI) Driver.
|
||||
|
||||
[Filer]: https://github.com/chrislusf/seaweedfs/wiki/Directories-and-Files
|
||||
[Mount]: https://github.com/chrislusf/seaweedfs/wiki/Mount
|
||||
@@ -132,6 +133,7 @@ On top of the object store, optional [Filer] can support directories and POSIX a
|
||||
[FilerDataEncryption]: https://github.com/chrislusf/seaweedfs/wiki/Filer-Data-Encryption
|
||||
[FilerTTL]: https://github.com/chrislusf/seaweedfs/wiki/Filer-Stores
|
||||
[VolumeServerTTL]: https://github.com/chrislusf/seaweedfs/wiki/Store-file-with-a-Time-To-Live
|
||||
[SeaweedFsCsiDriver]: https://github.com/seaweedfs/seaweedfs-csi-driver
|
||||
|
||||
[Back to TOC](#table-of-contents)
|
||||
|
||||
|
||||
@@ -9,11 +9,17 @@ case "$1" in
|
||||
|
||||
'volume')
|
||||
ARGS="-dir=/data -max=0"
|
||||
if [[ $@ == *"-max="* ]]; then
|
||||
ARGS="-dir=/data"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'server')
|
||||
ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024"
|
||||
if [[ $@ == *"-volume.max="* ]]; then
|
||||
ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: v1
|
||||
description: SeaweedFS
|
||||
name: seaweedfs
|
||||
version: 1.78
|
||||
version: 1.82
|
||||
@@ -4,7 +4,7 @@ global:
|
||||
registry: ""
|
||||
repository: ""
|
||||
imageName: chrislusf/seaweedfs
|
||||
imageTag: "1.78"
|
||||
imageTag: "1.82"
|
||||
imagePullPolicy: IfNotPresent
|
||||
imagePullSecrets: imagepullsecret
|
||||
restartPolicy: Always
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-client</artifactId>
|
||||
<version>1.2.7</version>
|
||||
<version>1.2.9</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-client</artifactId>
|
||||
<version>1.2.9</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<protobuf.version>3.9.1</protobuf.version>
|
||||
<!-- follow https://github.com/grpc/grpc-java -->
|
||||
<grpc.version>1.23.0</grpc.version>
|
||||
<guava.version>28.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.moandjiezana.toml</groupId>
|
||||
<artifactId>toml4j</artifactId>
|
||||
<version>0.7.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>${protobuf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-netty-shaded</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-protobuf</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-stub</artifactId>
|
||||
<version>${grpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>os-maven-plugin</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.xolstice.maven.plugins</groupId>
|
||||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
<version>0.6.1</version>
|
||||
<configuration>
|
||||
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
|
||||
</protocArtifact>
|
||||
<pluginId>grpc-java</pluginId>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
|
||||
</pluginArtifact>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>compile-custom</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -7,6 +7,8 @@ import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
@@ -14,7 +16,7 @@ import java.util.*;
|
||||
|
||||
public class SeaweedRead {
|
||||
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class);
|
||||
|
||||
static ChunkCache chunkCache = new ChunkCache(1000);
|
||||
|
||||
@@ -64,7 +66,9 @@ public class SeaweedRead {
|
||||
chunkData = doFetchFullChunkData(chunkView, locations);
|
||||
}
|
||||
|
||||
int len = (int) (chunkView.logicOffset - position + chunkView.size);
|
||||
int len = (int) chunkView.size;
|
||||
LOG.debug("readChunkView fid:{} chunkData.length:{} chunkView.offset:{} buffer.length:{} startOffset:{} len:{}",
|
||||
chunkView.fileId, chunkData.length, chunkView.offset, buffer.length, startOffset, len);
|
||||
System.arraycopy(chunkData, (int) chunkView.offset, buffer, startOffset, len);
|
||||
|
||||
chunkCache.setChunk(chunkView.fileId, chunkData);
|
||||
|
||||
@@ -45,28 +45,32 @@ public class SeaweedWrite {
|
||||
|
||||
String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey);
|
||||
|
||||
synchronized (entry) {
|
||||
entry.addChunks(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId(fileId)
|
||||
.setOffset(offset)
|
||||
.setSize(bytesLength)
|
||||
.setMtime(System.currentTimeMillis() / 10000L)
|
||||
.setETag(etag)
|
||||
.setCipherKey(cipherKeyString)
|
||||
);
|
||||
}
|
||||
|
||||
// cache fileId ~ bytes
|
||||
SeaweedRead.chunkCache.setChunk(fileId, bytes);
|
||||
|
||||
entry.addChunks(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId(fileId)
|
||||
.setOffset(offset)
|
||||
.setSize(bytesLength)
|
||||
.setMtime(System.currentTimeMillis() / 10000L)
|
||||
.setETag(etag)
|
||||
.setCipherKey(cipherKeyString)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static void writeMeta(final FilerGrpcClient filerGrpcClient,
|
||||
final String parentDirectory, final FilerProto.Entry.Builder entry) {
|
||||
filerGrpcClient.getBlockingStub().createEntry(
|
||||
FilerProto.CreateEntryRequest.newBuilder()
|
||||
.setDirectory(parentDirectory)
|
||||
.setEntry(entry)
|
||||
.build()
|
||||
);
|
||||
synchronized (entry){
|
||||
filerGrpcClient.getBlockingStub().createEntry(
|
||||
FilerProto.CreateEntryRequest.newBuilder()
|
||||
.setDirectory(parentDirectory)
|
||||
.setEntry(entry)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static String multipartUpload(String targetUrl,
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.7</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.9</seaweedfs.client.version>
|
||||
<hadoop.version>2.9.2</hadoop.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.7</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.9</seaweedfs.client.version>
|
||||
<hadoop.version>2.9.2</hadoop.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -64,6 +64,16 @@ public class SeaweedFileSystemStore {
|
||||
public FileStatus[] listEntries(final Path path) {
|
||||
LOG.debug("listEntries path: {}", path);
|
||||
|
||||
FileStatus pathStatus = getFileStatus(path);
|
||||
|
||||
if (pathStatus == null) {
|
||||
return new FileStatus[0];
|
||||
}
|
||||
|
||||
if (!pathStatus.isDirectory()) {
|
||||
return new FileStatus[]{pathStatus};
|
||||
}
|
||||
|
||||
List<FileStatus> fileStatuses = new ArrayList<FileStatus>();
|
||||
|
||||
List<FilerProto.Entry> entries = filerClient.listEntries(path.toUri().getPath());
|
||||
@@ -74,7 +84,9 @@ public class SeaweedFileSystemStore {
|
||||
|
||||
fileStatuses.add(fileStatus);
|
||||
}
|
||||
LOG.debug("listEntries path: {} size {}", fileStatuses, fileStatuses.size());
|
||||
return fileStatuses.toArray(new FileStatus[0]);
|
||||
|
||||
}
|
||||
|
||||
public FileStatus getFileStatus(final Path path) {
|
||||
|
||||
@@ -69,9 +69,6 @@ public class SeaweedOutputStream extends OutputStream {
|
||||
}
|
||||
|
||||
private synchronized void flushWrittenBytesToServiceInternal(final long offset) throws IOException {
|
||||
|
||||
LOG.debug("SeaweedWrite.writeMeta path: {} entry:{}", path, entry);
|
||||
|
||||
try {
|
||||
SeaweedWrite.writeMeta(filerGrpcClient, getParentDirectory(path), entry);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.7</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.9</seaweedfs.client.version>
|
||||
<hadoop.version>3.1.1</hadoop.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.7</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.9</seaweedfs.client.version>
|
||||
<hadoop.version>3.1.1</hadoop.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -64,6 +64,16 @@ public class SeaweedFileSystemStore {
|
||||
public FileStatus[] listEntries(final Path path) {
|
||||
LOG.debug("listEntries path: {}", path);
|
||||
|
||||
FileStatus pathStatus = getFileStatus(path);
|
||||
|
||||
if (pathStatus == null) {
|
||||
return new FileStatus[0];
|
||||
}
|
||||
|
||||
if (!pathStatus.isDirectory()) {
|
||||
return new FileStatus[]{pathStatus};
|
||||
}
|
||||
|
||||
List<FileStatus> fileStatuses = new ArrayList<FileStatus>();
|
||||
|
||||
List<FilerProto.Entry> entries = filerClient.listEntries(path.toUri().getPath());
|
||||
@@ -74,7 +84,9 @@ public class SeaweedFileSystemStore {
|
||||
|
||||
fileStatuses.add(fileStatus);
|
||||
}
|
||||
LOG.debug("listEntries path: {} size {}", fileStatuses, fileStatuses.size());
|
||||
return fileStatuses.toArray(new FileStatus[0]);
|
||||
|
||||
}
|
||||
|
||||
public FileStatus getFileStatus(final Path path) {
|
||||
|
||||
@@ -78,9 +78,6 @@ public class SeaweedOutputStream extends OutputStream implements Syncable, Strea
|
||||
}
|
||||
|
||||
private synchronized void flushWrittenBytesToServiceInternal(final long offset) throws IOException {
|
||||
|
||||
LOG.debug("SeaweedWrite.writeMeta path: {} entry:{}", path, entry);
|
||||
|
||||
try {
|
||||
SeaweedWrite.writeMeta(filerGrpcClient, getParentDirectory(path), entry);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
"github.com/syndtr/goleveldb/leveldb/errors"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"github.com/syndtr/goleveldb/leveldb/util"
|
||||
)
|
||||
@@ -25,6 +26,9 @@ func main() {
|
||||
}
|
||||
|
||||
db, err := leveldb.OpenFile(*dir, opts)
|
||||
if errors.IsCorrupted(err) {
|
||||
db, err = leveldb.RecoverFile(*dir, opts)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
@@ -31,7 +32,8 @@ func (scanner *VolumeFileScanner4SeeDat) ReadNeedleBody() bool {
|
||||
|
||||
func (scanner *VolumeFileScanner4SeeDat) VisitNeedle(n *needle.Needle, offset int64, needleHeader, needleBody []byte) error {
|
||||
t := time.Unix(int64(n.AppendAtNs)/int64(time.Second), int64(n.AppendAtNs)%int64(time.Second))
|
||||
glog.V(0).Infof("%d,%s%x offset %d size %d cookie %x appendedAt %v", *volumeId, n.Id, n.Cookie, offset, n.Size, n.Cookie, t)
|
||||
glog.V(0).Infof("%d,%s%x offset %d size %d(%s) cookie %x appendedAt %v",
|
||||
*volumeId, n.Id, n.Cookie, offset, n.Size, util.BytesToHumanReadable(uint64(n.Size)), n.Cookie, t)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"crypto/md5"
|
||||
"flag"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/super_block"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type VolumeFileScanner4SeeDat struct {
|
||||
version needle.Version
|
||||
}
|
||||
|
||||
func (scanner *VolumeFileScanner4SeeDat) VisitSuperBlock(superBlock super_block.SuperBlock) error {
|
||||
scanner.version = superBlock.Version
|
||||
return nil
|
||||
}
|
||||
|
||||
func (scanner *VolumeFileScanner4SeeDat) ReadNeedleBody() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var (
|
||||
files = int64(0)
|
||||
filebytes = int64(0)
|
||||
diffbytes = int64(0)
|
||||
)
|
||||
|
||||
func Compresssion(data []byte) float64 {
|
||||
if len(data) <= 128 {
|
||||
return 100.0
|
||||
}
|
||||
compressed, _ := util.GzipData(data[0:128])
|
||||
return float64(len(compressed)*10) / 1280.0
|
||||
}
|
||||
|
||||
func (scanner *VolumeFileScanner4SeeDat) VisitNeedle(n *needle.Needle, offset int64, needleHeader, needleBody []byte) error {
|
||||
t := time.Unix(int64(n.AppendAtNs)/int64(time.Second), int64(n.AppendAtNs)%int64(time.Second))
|
||||
glog.V(0).Info("----------------------------------------------------------------------------------")
|
||||
glog.V(0).Infof("%d,%s%x offset %d size %d(%s) cookie %x appendedAt %v hasmime[%t] mime[%s] (len: %d)",
|
||||
*volumeId, n.Id, n.Cookie, offset, n.Size, util.BytesToHumanReadable(uint64(n.Size)), n.Cookie, t, n.HasMime(), string(n.Mime), len(n.Mime))
|
||||
r, err := gzip.NewReader(bytes.NewReader(n.Data))
|
||||
if err == nil {
|
||||
buf := bytes.Buffer{}
|
||||
h := md5.New()
|
||||
c, _ := io.Copy(&buf, r)
|
||||
d := buf.Bytes()
|
||||
io.Copy(h, bytes.NewReader(d))
|
||||
diff := (int64(n.DataSize) - int64(c))
|
||||
diffbytes += diff
|
||||
glog.V(0).Infof("was gzip! stored_size: %d orig_size: %d diff: %d(%d) mime:%s compression-of-128: %.2f md5: %x", n.DataSize, c, diff, diffbytes, http.DetectContentType(d), Compresssion(d), h.Sum(nil))
|
||||
} else {
|
||||
glog.V(0).Infof("no gzip!")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
_ = ioutil.ReadAll
|
||||
volumePath = flag.String("dir", "/tmp", "data directory to store files")
|
||||
volumeCollection = flag.String("collection", "", "the volume collection name")
|
||||
volumeId = flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir. The volume index file should not exist.")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
vid := needle.VolumeId(*volumeId)
|
||||
glog.V(0).Info("Starting")
|
||||
scanner := &VolumeFileScanner4SeeDat{}
|
||||
err := storage.ScanVolumeFile(*volumePath, *volumeCollection, vid, storage.NeedleMapInMemory, scanner)
|
||||
if err != nil {
|
||||
glog.Fatalf("Reading Volume File [ERROR] %s\n", err)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
@@ -36,7 +37,7 @@ func main() {
|
||||
defer indexFile.Close()
|
||||
|
||||
idx.WalkIndexFile(indexFile, func(key types.NeedleId, offset types.Offset, size uint32) error {
|
||||
fmt.Printf("key:%v offset:%v size:%v\n", key, offset, size)
|
||||
fmt.Printf("key:%v offset:%v size:%v(%v)\n", key, offset, size, util.BytesToHumanReadable(uint64(size)))
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||
util2 "github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/tools/godoc/util"
|
||||
)
|
||||
|
||||
@@ -25,7 +24,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
util2.LoadConfiguration("security", false)
|
||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||
grpcDialOption := security.LoadClientTLS(util2.GetViper(), "grpc.client")
|
||||
|
||||
vid := needle.VolumeId(*volumeId)
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ func runBenchmark(cmd *Command, args []string) bool {
|
||||
util.LoadConfiguration("security", false)
|
||||
b.grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||
|
||||
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.VERSION, runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
if *b.maxCpu < 1 {
|
||||
*b.maxCpu = runtime.NumCPU()
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ func (fo *FilerOptions) startFiler() {
|
||||
|
||||
if *fo.publicPort != 0 {
|
||||
publicListeningAddress := *fo.bindIp + ":" + strconv.Itoa(*fo.publicPort)
|
||||
glog.V(0).Infoln("Start Seaweed filer server", util.VERSION, "public at", publicListeningAddress)
|
||||
glog.V(0).Infoln("Start Seaweed filer server", util.Version(), "public at", publicListeningAddress)
|
||||
publicListener, e := util.NewListener(publicListeningAddress, 0)
|
||||
if e != nil {
|
||||
glog.Fatalf("Filer server public listener error on port %d:%v", *fo.publicPort, e)
|
||||
@@ -133,7 +133,7 @@ func (fo *FilerOptions) startFiler() {
|
||||
}()
|
||||
}
|
||||
|
||||
glog.V(0).Infof("Start Seaweed Filer %s at %s:%d", util.VERSION, *fo.ip, *fo.port)
|
||||
glog.V(0).Infof("Start Seaweed Filer %s at %s:%d", util.Version(), *fo.ip, *fo.port)
|
||||
filerListener, e := util.NewListener(
|
||||
*fo.bindIp+":"+strconv.Itoa(*fo.port),
|
||||
time.Duration(10)*time.Second,
|
||||
|
||||
@@ -33,7 +33,7 @@ type MasterOptions struct {
|
||||
peers *string
|
||||
volumeSizeLimitMB *uint
|
||||
volumePreallocate *bool
|
||||
pulseSeconds *int
|
||||
// pulseSeconds *int
|
||||
defaultReplication *string
|
||||
garbageThreshold *float64
|
||||
whiteList *string
|
||||
@@ -51,7 +51,7 @@ func init() {
|
||||
m.peers = cmdMaster.Flag.String("peers", "", "all master nodes in comma separated ip:port list, example: 127.0.0.1:9093,127.0.0.1:9094,127.0.0.1:9095")
|
||||
m.volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 30*1000, "Master stops directing writes to oversized volumes.")
|
||||
m.volumePreallocate = cmdMaster.Flag.Bool("volumePreallocate", false, "Preallocate disk space for volumes.")
|
||||
m.pulseSeconds = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
// m.pulseSeconds = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
m.defaultReplication = cmdMaster.Flag.String("defaultReplication", "000", "Default replication type if not specified.")
|
||||
m.garbageThreshold = cmdMaster.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
|
||||
m.whiteList = cmdMaster.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||
@@ -111,14 +111,14 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
|
||||
r := mux.NewRouter()
|
||||
ms := weed_server.NewMasterServer(r, masterOption.toMasterOption(masterWhiteList), peers)
|
||||
listeningAddress := *masterOption.ipBind + ":" + strconv.Itoa(*masterOption.port)
|
||||
glog.V(0).Infof("Start Seaweed Master %s at %s", util.VERSION, listeningAddress)
|
||||
glog.V(0).Infof("Start Seaweed Master %s at %s", util.Version(), listeningAddress)
|
||||
masterListener, e := util.NewListener(listeningAddress, 0)
|
||||
if e != nil {
|
||||
glog.Fatalf("Master startup error: %v", e)
|
||||
}
|
||||
// start raftServer
|
||||
raftServer := weed_server.NewRaftServer(security.LoadClientTLS(util.GetViper(), "grpc.master"),
|
||||
peers, myMasterAddress, *masterOption.metaFolder, ms.Topo, *masterOption.pulseSeconds)
|
||||
peers, myMasterAddress, *masterOption.metaFolder, ms.Topo, 5)
|
||||
if raftServer == nil {
|
||||
glog.Fatalf("please verify %s is writable, see https://github.com/chrislusf/seaweedfs/issues/717", *masterOption.metaFolder)
|
||||
}
|
||||
@@ -135,7 +135,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
|
||||
master_pb.RegisterSeaweedServer(grpcS, ms)
|
||||
protobuf.RegisterRaftServer(grpcS, raftServer)
|
||||
reflection.Register(grpcS)
|
||||
glog.V(0).Infof("Start Seaweed Master %s grpc server at %s:%d", util.VERSION, *masterOption.ipBind, grpcPort)
|
||||
glog.V(0).Infof("Start Seaweed Master %s grpc server at %s:%d", util.Version(), *masterOption.ipBind, grpcPort)
|
||||
go grpcS.Serve(grpcL)
|
||||
|
||||
go ms.MasterClient.KeepConnectedToMaster()
|
||||
@@ -178,7 +178,7 @@ func (m *MasterOptions) toMasterOption(whiteList []string) *weed_server.MasterOp
|
||||
MetaFolder: *m.metaFolder,
|
||||
VolumeSizeLimitMB: *m.volumeSizeLimitMB,
|
||||
VolumePreallocate: *m.volumePreallocate,
|
||||
PulseSeconds: *m.pulseSeconds,
|
||||
// PulseSeconds: *m.pulseSeconds,
|
||||
DefaultReplicaPlacement: *m.defaultReplication,
|
||||
GarbageThreshold: *m.garbageThreshold,
|
||||
WhiteList: whiteList,
|
||||
|
||||
@@ -8,6 +8,7 @@ type MountOptions struct {
|
||||
filer *string
|
||||
filerMountRootPath *string
|
||||
dir *string
|
||||
dirAutoCreate *bool
|
||||
dirListCacheLimit *int64
|
||||
collection *string
|
||||
replication *string
|
||||
@@ -20,7 +21,6 @@ type MountOptions struct {
|
||||
umaskString *string
|
||||
nonempty *bool
|
||||
outsideContainerClusterMode *bool
|
||||
asyncMetaDataCaching *bool
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -34,13 +34,14 @@ func init() {
|
||||
mountOptions.filer = cmdMount.Flag.String("filer", "localhost:8888", "weed filer location")
|
||||
mountOptions.filerMountRootPath = cmdMount.Flag.String("filer.path", "/", "mount this remote path from filer server")
|
||||
mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory")
|
||||
mountOptions.dirAutoCreate = cmdMount.Flag.Bool("dirAutoCreate", false, "auto create the directory to mount to")
|
||||
mountOptions.dirListCacheLimit = cmdMount.Flag.Int64("dirListCacheLimit", 1000000, "limit cache size to speed up directory long format listing")
|
||||
mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files")
|
||||
mountOptions.replication = cmdMount.Flag.String("replication", "", "replication(e.g. 000, 001) to create to files. If empty, let filer decide.")
|
||||
mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
|
||||
mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 16, "local write buffer size, also chunk large files")
|
||||
mountOptions.cacheDir = cmdMount.Flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks")
|
||||
mountOptions.cacheSizeMB = cmdMount.Flag.Int64("cacheCapacityMB", 1000, "local cache capacity in MB (0 will disable cache)")
|
||||
mountOptions.cacheDir = cmdMount.Flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks and meta data")
|
||||
mountOptions.cacheSizeMB = cmdMount.Flag.Int64("cacheCapacityMB", 1000, "local file chunk cache capacity in MB (0 will disable cache)")
|
||||
mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center")
|
||||
mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system")
|
||||
mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111")
|
||||
@@ -48,7 +49,6 @@ func init() {
|
||||
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
||||
mountOptions.outsideContainerClusterMode = cmdMount.Flag.Bool("outsideContainerClusterMode", false, "allows other users to access the file system")
|
||||
mountOptions.asyncMetaDataCaching = cmdMount.Flag.Bool("asyncMetaDataCaching", true, "async meta data caching. this feature will be permanent and this option will be removed.")
|
||||
}
|
||||
|
||||
var cmdMount = &Command{
|
||||
|
||||
@@ -34,7 +34,7 @@ func runMount(cmd *Command, args []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if len(args)>0 {
|
||||
if len(args) > 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||
|
||||
util.LoadConfiguration("security", false)
|
||||
|
||||
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.VERSION, runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
if dir == "" {
|
||||
fmt.Printf("Please specify the mount directory via \"-dir\"")
|
||||
return false
|
||||
@@ -88,6 +88,9 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||
uid, gid := uint32(0), uint32(0)
|
||||
|
||||
// detect mount folder mode
|
||||
if *option.dirAutoCreate {
|
||||
os.MkdirAll(dir, 0755)
|
||||
}
|
||||
mountMode := os.ModeDir | 0755
|
||||
fileInfo, err := os.Stat(dir)
|
||||
if err == nil {
|
||||
@@ -167,7 +170,6 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||
MountMtime: time.Now(),
|
||||
Umask: umask,
|
||||
OutsideContainerClusterMode: *mountOptions.outsideContainerClusterMode,
|
||||
AsyncMetaDataCaching: *mountOptions.asyncMetaDataCaching,
|
||||
Cipher: cipher,
|
||||
})
|
||||
|
||||
|
||||
+2
-2
@@ -170,12 +170,12 @@ func (s3opt *S3Options) startS3Server() bool {
|
||||
}
|
||||
|
||||
if *s3opt.tlsPrivateKey != "" {
|
||||
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.VERSION, *s3opt.port)
|
||||
glog.V(0).Infof("Start Seaweed S3 API Server %s at https port %d", util.Version(), *s3opt.port)
|
||||
if err = httpS.ServeTLS(s3ApiListener, *s3opt.tlsCertificate, *s3opt.tlsPrivateKey); err != nil {
|
||||
glog.Fatalf("S3 API Server Fail to serve: %v", err)
|
||||
}
|
||||
} else {
|
||||
glog.V(0).Infof("Start Seaweed S3 API Server %s at http port %d", util.VERSION, *s3opt.port)
|
||||
glog.V(0).Infof("Start Seaweed S3 API Server %s at http port %d", util.Version(), *s3opt.port)
|
||||
if err = httpS.Serve(s3ApiListener); err != nil {
|
||||
glog.Fatalf("S3 API Server Fail to serve: %v", err)
|
||||
}
|
||||
|
||||
+11
-5
@@ -30,7 +30,7 @@ func init() {
|
||||
}
|
||||
|
||||
var cmdServer = &Command{
|
||||
UsageLine: "server -port=8080 -dir=/tmp -volume.max=5 -ip=server_name",
|
||||
UsageLine: "server -dir=/tmp -volume.max=5 -ip=server_name",
|
||||
Short: "start a master server, a volume server, and optionally a filer and a S3 gateway",
|
||||
Long: `start both a volume server to provide storage spaces
|
||||
and a master server to provide volume=>location mapping service and sequence number of file ids
|
||||
@@ -55,12 +55,16 @@ var (
|
||||
serverDisableHttp = cmdServer.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
||||
volumeDataFolders = cmdServer.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||
volumeMaxDataVolumeCounts = cmdServer.Flag.String("volume.max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||
pulseSeconds = cmdServer.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
volumeMinFreeSpacePercent = cmdServer.Flag.String("volume.minFreeSpacePercent", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
||||
|
||||
// pulseSeconds = cmdServer.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
isStartingFiler = cmdServer.Flag.Bool("filer", false, "whether to start filer")
|
||||
isStartingS3 = cmdServer.Flag.Bool("s3", false, "whether to start S3 gateway")
|
||||
isStartingMsgBroker = cmdServer.Flag.Bool("msgBroker", false, "whether to start message broker")
|
||||
|
||||
serverWhiteList []string
|
||||
|
||||
False = false
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -93,6 +97,7 @@ func init() {
|
||||
serverOptions.v.compactionMBPerSecond = cmdServer.Flag.Int("volume.compactionMBps", 0, "limit compaction speed in mega bytes per second")
|
||||
serverOptions.v.fileSizeLimitMB = cmdServer.Flag.Int("volume.fileSizeLimitMB", 256, "limit file size to avoid out of memory")
|
||||
serverOptions.v.publicUrl = cmdServer.Flag.String("volume.publicUrl", "", "publicly accessible address")
|
||||
serverOptions.v.pprof = &False
|
||||
|
||||
s3Options.port = cmdServer.Flag.Int("s3.port", 8333, "s3 server http listen port")
|
||||
s3Options.domainName = cmdServer.Flag.String("s3.domainName", "", "suffix of the host name, {bucket}.{domainName}")
|
||||
@@ -142,8 +147,8 @@ func runServer(cmd *Command, args []string) bool {
|
||||
serverOptions.v.rack = serverRack
|
||||
msgBrokerOptions.ip = serverIp
|
||||
|
||||
serverOptions.v.pulseSeconds = pulseSeconds
|
||||
masterOptions.pulseSeconds = pulseSeconds
|
||||
// serverOptions.v.pulseSeconds = pulseSeconds
|
||||
// masterOptions.pulseSeconds = pulseSeconds
|
||||
|
||||
masterOptions.whiteList = serverWhiteListOption
|
||||
|
||||
@@ -206,7 +211,8 @@ func runServer(cmd *Command, args []string) bool {
|
||||
|
||||
// start volume server
|
||||
{
|
||||
go serverOptions.v.startVolumeServer(*volumeDataFolders, *volumeMaxDataVolumeCounts, *serverWhiteListOption)
|
||||
go serverOptions.v.startVolumeServer(*volumeDataFolders, *volumeMaxDataVolumeCounts, *serverWhiteListOption, *volumeMinFreeSpacePercent)
|
||||
|
||||
}
|
||||
|
||||
startMaster(masterOptions, serverWhiteList)
|
||||
|
||||
@@ -19,6 +19,6 @@ func runVersion(cmd *Command, args []string) bool {
|
||||
cmd.Usage()
|
||||
}
|
||||
|
||||
fmt.Printf("version %s %s %s\n", util.VERSION, runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf("version %s %s %s\n", util.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
return true
|
||||
}
|
||||
+39
-10
@@ -3,6 +3,7 @@ package command
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
httppprof "net/http/pprof"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
@@ -10,10 +11,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util/grace"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util/grace"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/httpdown"
|
||||
@@ -40,7 +42,6 @@ type VolumeServerOptions struct {
|
||||
publicUrl *string
|
||||
bindIp *string
|
||||
masters *string
|
||||
pulseSeconds *int
|
||||
idleConnectionTimeout *int
|
||||
dataCenter *string
|
||||
rack *string
|
||||
@@ -52,6 +53,9 @@ type VolumeServerOptions struct {
|
||||
memProfile *string
|
||||
compactionMBPerSecond *int
|
||||
fileSizeLimitMB *int
|
||||
minFreeSpacePercent []float32
|
||||
pprof *bool
|
||||
// pulseSeconds *int
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -62,7 +66,7 @@ func init() {
|
||||
v.publicUrl = cmdVolume.Flag.String("publicUrl", "", "Publicly accessible address")
|
||||
v.bindIp = cmdVolume.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to")
|
||||
v.masters = cmdVolume.Flag.String("mserver", "localhost:9333", "comma-separated master servers")
|
||||
v.pulseSeconds = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats, must be smaller than or equal to the master's setting")
|
||||
// v.pulseSeconds = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats, must be smaller than or equal to the master's setting")
|
||||
v.idleConnectionTimeout = cmdVolume.Flag.Int("idleTimeout", 30, "connection idle seconds")
|
||||
v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name")
|
||||
v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name")
|
||||
@@ -73,6 +77,7 @@ func init() {
|
||||
v.memProfile = cmdVolume.Flag.String("memprofile", "", "memory profile output file")
|
||||
v.compactionMBPerSecond = cmdVolume.Flag.Int("compactionMBps", 0, "limit background compaction or copying speed in mega bytes per second")
|
||||
v.fileSizeLimitMB = cmdVolume.Flag.Int("fileSizeLimitMB", 256, "limit file size to avoid out of memory")
|
||||
v.pprof = cmdVolume.Flag.Bool("pprof", false, "enable pprof http handlers. precludes --memprofile and --cpuprofile")
|
||||
}
|
||||
|
||||
var cmdVolume = &Command{
|
||||
@@ -87,6 +92,7 @@ var (
|
||||
volumeFolders = cmdVolume.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||
maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||
volumeWhiteListOption = cmdVolume.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||
minFreeSpacePercent = cmdVolume.Flag.String("minFreeSpacePercent", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
||||
)
|
||||
|
||||
func runVolume(cmd *Command, args []string) bool {
|
||||
@@ -94,14 +100,19 @@ func runVolume(cmd *Command, args []string) bool {
|
||||
util.LoadConfiguration("security", false)
|
||||
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
grace.SetupProfiling(*v.cpuProfile, *v.memProfile)
|
||||
|
||||
v.startVolumeServer(*volumeFolders, *maxVolumeCounts, *volumeWhiteListOption)
|
||||
// If --pprof is set we assume the caller wants to be able to collect
|
||||
// cpu and memory profiles via go tool pprof
|
||||
if !*v.pprof {
|
||||
grace.SetupProfiling(*v.cpuProfile, *v.memProfile)
|
||||
}
|
||||
|
||||
v.startVolumeServer(*volumeFolders, *maxVolumeCounts, *volumeWhiteListOption, *minFreeSpacePercent)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, volumeWhiteListOption string) {
|
||||
func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, volumeWhiteListOption, minFreeSpacePercent string) {
|
||||
|
||||
// Set multiple folders and each folder's max volume count limit'
|
||||
v.folders = strings.Split(volumeFolders, ",")
|
||||
@@ -116,6 +127,16 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
|
||||
if len(v.folders) != len(v.folderMaxLimits) {
|
||||
glog.Fatalf("%d directories by -dir, but only %d max is set by -max", len(v.folders), len(v.folderMaxLimits))
|
||||
}
|
||||
minFreeSpacePercentStrings := strings.Split(minFreeSpacePercent, ",")
|
||||
for _, freeString := range minFreeSpacePercentStrings {
|
||||
|
||||
if value, e := strconv.ParseFloat(freeString, 32); e == nil {
|
||||
v.minFreeSpacePercent = append(v.minFreeSpacePercent, float32(value))
|
||||
} else {
|
||||
glog.Fatalf("The value specified in -minFreeSpacePercent not a valid value %s", freeString)
|
||||
}
|
||||
}
|
||||
|
||||
for _, folder := range v.folders {
|
||||
if err := util.TestFolderWritable(folder); err != nil {
|
||||
glog.Fatalf("Check Data Folder(-dir) Writable %s : %s", folder, err)
|
||||
@@ -145,6 +166,14 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
|
||||
publicVolumeMux = http.NewServeMux()
|
||||
}
|
||||
|
||||
if *v.pprof {
|
||||
volumeMux.HandleFunc("/debug/pprof/", httppprof.Index)
|
||||
volumeMux.HandleFunc("/debug/pprof/cmdline", httppprof.Cmdline)
|
||||
volumeMux.HandleFunc("/debug/pprof/profile", httppprof.Profile)
|
||||
volumeMux.HandleFunc("/debug/pprof/symbol", httppprof.Symbol)
|
||||
volumeMux.HandleFunc("/debug/pprof/trace", httppprof.Trace)
|
||||
}
|
||||
|
||||
volumeNeedleMapKind := storage.NeedleMapInMemory
|
||||
switch *v.indexType {
|
||||
case "leveldb":
|
||||
@@ -159,9 +188,9 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
|
||||
|
||||
volumeServer := weed_server.NewVolumeServer(volumeMux, publicVolumeMux,
|
||||
*v.ip, *v.port, *v.publicUrl,
|
||||
v.folders, v.folderMaxLimits,
|
||||
v.folders, v.folderMaxLimits, v.minFreeSpacePercent,
|
||||
volumeNeedleMapKind,
|
||||
strings.Split(masters, ","), *v.pulseSeconds, *v.dataCenter, *v.rack,
|
||||
strings.Split(masters, ","), 5, *v.dataCenter, *v.rack,
|
||||
v.whiteList,
|
||||
*v.fixJpgOrientation, *v.readRedirect,
|
||||
*v.compactionMBPerSecond,
|
||||
@@ -250,7 +279,7 @@ func (v VolumeServerOptions) startGrpcService(vs volume_server_pb.VolumeServerSe
|
||||
|
||||
func (v VolumeServerOptions) startPublicHttpService(handler http.Handler) httpdown.Server {
|
||||
publicListeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.publicPort)
|
||||
glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "public at", publicListeningAddress)
|
||||
glog.V(0).Infoln("Start Seaweed volume server", util.Version(), "public at", publicListeningAddress)
|
||||
publicListener, e := util.NewListener(publicListeningAddress, time.Duration(*v.idleConnectionTimeout)*time.Second)
|
||||
if e != nil {
|
||||
glog.Fatalf("Volume server listener error:%v", e)
|
||||
@@ -277,7 +306,7 @@ func (v VolumeServerOptions) startClusterHttpService(handler http.Handler) httpd
|
||||
}
|
||||
|
||||
listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port)
|
||||
glog.V(0).Infof("Start Seaweed volume server %s at %s", util.VERSION, listeningAddress)
|
||||
glog.V(0).Infof("Start Seaweed volume server %s at %s", util.Version(), listeningAddress)
|
||||
listener, e := util.NewListener(listeningAddress, time.Duration(*v.idleConnectionTimeout)*time.Second)
|
||||
if e != nil {
|
||||
glog.Fatalf("Volume server listener error:%v", e)
|
||||
|
||||
@@ -54,7 +54,7 @@ func runWebDav(cmd *Command, args []string) bool {
|
||||
|
||||
util.LoadConfiguration("security", false)
|
||||
|
||||
glog.V(0).Infof("Starting Seaweed WebDav Server %s at https port %d", util.VERSION, *webDavStandaloneOptions.port)
|
||||
glog.V(0).Infof("Starting Seaweed WebDav Server %s at https port %d", util.Version(), *webDavStandaloneOptions.port)
|
||||
|
||||
return webDavStandaloneOptions.startWebDav()
|
||||
|
||||
@@ -126,12 +126,12 @@ func (wo *WebDavOption) startWebDav() bool {
|
||||
}
|
||||
|
||||
if *wo.tlsPrivateKey != "" {
|
||||
glog.V(0).Infof("Start Seaweed WebDav Server %s at https port %d", util.VERSION, *wo.port)
|
||||
glog.V(0).Infof("Start Seaweed WebDav Server %s at https port %d", util.Version(), *wo.port)
|
||||
if err = httpS.ServeTLS(webDavListener, *wo.tlsCertificate, *wo.tlsPrivateKey); err != nil {
|
||||
glog.Fatalf("WebDav Server Fail to serve: %v", err)
|
||||
}
|
||||
} else {
|
||||
glog.V(0).Infof("Start Seaweed WebDav Server %s at http port %d", util.VERSION, *wo.port)
|
||||
glog.V(0).Infof("Start Seaweed WebDav Server %s at http port %d", util.Version(), *wo.port)
|
||||
if err = httpS.Serve(webDavListener); err != nil {
|
||||
glog.Fatalf("WebDav Server Fail to serve: %v", err)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
"github.com/syndtr/goleveldb/leveldb/errors"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
|
||||
|
||||
@@ -49,8 +50,13 @@ func (store *LevelDBStore) initialize(dir string) (err error) {
|
||||
}
|
||||
|
||||
if store.db, err = leveldb.OpenFile(dir, opts); err != nil {
|
||||
glog.Infof("filer store open dir %s: %v", dir, err)
|
||||
return
|
||||
if errors.IsCorrupted(err) {
|
||||
store.db, err = leveldb.RecoverFile(dir, opts)
|
||||
}
|
||||
if err != nil {
|
||||
glog.Infof("filer store open dir %s: %v", dir, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
"github.com/syndtr/goleveldb/leveldb/errors"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
|
||||
|
||||
@@ -52,9 +53,12 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
|
||||
dbFolder := fmt.Sprintf("%s/%02d", dir, d)
|
||||
os.MkdirAll(dbFolder, 0755)
|
||||
db, dbErr := leveldb.OpenFile(dbFolder, opts)
|
||||
if errors.IsCorrupted(dbErr) {
|
||||
db, dbErr = leveldb.RecoverFile(dbFolder, opts)
|
||||
}
|
||||
if dbErr != nil {
|
||||
glog.Errorf("filer store open dir %s: %v", dbFolder, dbErr)
|
||||
return
|
||||
return dbErr
|
||||
}
|
||||
store.dbs = append(store.dbs, db)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func (c *ChunkReadAt) ReadAt(p []byte, offset int64) (n int, err error) {
|
||||
n += readCount
|
||||
err = readErr
|
||||
if readCount == 0 {
|
||||
return n, nil
|
||||
return n, io.EOF
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
+30
-67
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/filesys/meta_cache"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
@@ -89,22 +90,18 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
|
||||
}
|
||||
|
||||
func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node {
|
||||
return dir.wfs.fsNodeCache.EnsureFsNode(util.NewFullPath(dir.FullPath(), name), func() fs.Node {
|
||||
return &File{
|
||||
Name: name,
|
||||
dir: dir,
|
||||
wfs: dir.wfs,
|
||||
entry: entry,
|
||||
entryViewCache: nil,
|
||||
}
|
||||
})
|
||||
return &File{
|
||||
Name: name,
|
||||
dir: dir,
|
||||
wfs: dir.wfs,
|
||||
entry: entry,
|
||||
entryViewCache: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (dir *Dir) newDirectory(fullpath util.FullPath, entry *filer_pb.Entry) fs.Node {
|
||||
|
||||
return dir.wfs.fsNodeCache.EnsureFsNode(fullpath, func() fs.Node {
|
||||
return &Dir{name: entry.Name, wfs: dir.wfs, entry: entry, parent: dir}
|
||||
})
|
||||
return &Dir{name: entry.Name, wfs: dir.wfs, entry: entry, parent: dir}
|
||||
|
||||
}
|
||||
|
||||
@@ -139,9 +136,7 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
@@ -190,9 +185,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
||||
return err
|
||||
}
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
return nil
|
||||
})
|
||||
@@ -212,16 +205,15 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
|
||||
|
||||
glog.V(4).Infof("dir Lookup %s: %s by %s", dir.FullPath(), req.Name, req.Header.String())
|
||||
|
||||
fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)
|
||||
entry := dir.wfs.cacheGet(fullFilePath)
|
||||
dirPath := dir.FullPath()
|
||||
fullFilePath := util.NewFullPath(dirPath, req.Name)
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
cachedEntry, cacheErr := dir.wfs.metaCache.FindEntry(context.Background(), fullFilePath)
|
||||
if cacheErr == filer_pb.ErrNotFound {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
entry = cachedEntry.ToProtoEntry()
|
||||
meta_cache.EnsureVisited(dir.wfs.metaCache, dir.wfs, util.FullPath(dirPath))
|
||||
cachedEntry, cacheErr := dir.wfs.metaCache.FindEntry(context.Background(), fullFilePath)
|
||||
if cacheErr == filer_pb.ErrNotFound {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
entry := cachedEntry.ToProtoEntry()
|
||||
|
||||
if entry == nil {
|
||||
// glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath)
|
||||
@@ -230,7 +222,6 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
|
||||
glog.V(1).Infof("dir GetEntry %s: %v", fullFilePath, err)
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
dir.wfs.cacheSet(fullFilePath, entry, 5*time.Minute)
|
||||
} else {
|
||||
glog.V(4).Infof("dir Lookup cache hit %s", fullFilePath)
|
||||
}
|
||||
@@ -262,7 +253,6 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||
|
||||
glog.V(3).Infof("dir ReadDirAll %s", dir.FullPath())
|
||||
|
||||
cacheTtl := 5 * time.Minute
|
||||
processEachEntryFn := func(entry *filer_pb.Entry, isLast bool) error {
|
||||
fullpath := util.NewFullPath(dir.FullPath(), entry.Name)
|
||||
inode := fullpath.AsInode()
|
||||
@@ -273,29 +263,21 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_File}
|
||||
ret = append(ret, dirent)
|
||||
}
|
||||
dir.wfs.cacheSet(fullpath, entry, cacheTtl)
|
||||
return nil
|
||||
}
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
listedEntries, listErr := dir.wfs.metaCache.ListDirectoryEntries(context.Background(), util.FullPath(dir.FullPath()), "", false, int(dir.wfs.option.DirListCacheLimit))
|
||||
if listErr != nil {
|
||||
glog.Errorf("list meta cache: %v", listErr)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
for _, cachedEntry := range listedEntries {
|
||||
processEachEntryFn(cachedEntry.ToProtoEntry(), false)
|
||||
}
|
||||
return
|
||||
dirPath := util.FullPath(dir.FullPath())
|
||||
meta_cache.EnsureVisited(dir.wfs.metaCache, dir.wfs, dirPath)
|
||||
listedEntries, listErr := dir.wfs.metaCache.ListDirectoryEntries(context.Background(), dirPath, "", false, int(dir.wfs.option.DirListCacheLimit))
|
||||
if listErr != nil {
|
||||
glog.Errorf("list meta cache: %v", listErr)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
readErr := filer_pb.ReadDirAllEntries(dir.wfs, util.FullPath(dir.FullPath()), "", processEachEntryFn)
|
||||
if readErr != nil {
|
||||
glog.V(0).Infof("list %s: %v", dir.FullPath(), err)
|
||||
return ret, fuse.EIO
|
||||
for _, cachedEntry := range listedEntries {
|
||||
processEachEntryFn(cachedEntry.ToProtoEntry(), false)
|
||||
}
|
||||
return
|
||||
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
@@ -321,12 +303,7 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
||||
|
||||
dir.wfs.deleteFileChunks(entry.Chunks)
|
||||
|
||||
dir.wfs.cacheDelete(filePath)
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
|
||||
}
|
||||
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
|
||||
|
||||
glog.V(3).Infof("remove file: %v", req)
|
||||
err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false)
|
||||
@@ -342,12 +319,8 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
||||
func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
||||
|
||||
t := util.NewFullPath(dir.FullPath(), req.Name)
|
||||
dir.wfs.cacheDelete(t)
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.DeleteEntry(context.Background(), t)
|
||||
}
|
||||
dir.wfs.metaCache.DeleteEntry(context.Background(), t)
|
||||
|
||||
glog.V(3).Infof("remove directory entry: %v", req)
|
||||
err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false)
|
||||
@@ -384,8 +357,6 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus
|
||||
dir.entry.Attributes.Mtime = req.Mtime.Unix()
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
}
|
||||
@@ -402,8 +373,6 @@ func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
}
|
||||
@@ -420,8 +389,6 @@ func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) e
|
||||
return err
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
}
|
||||
@@ -444,8 +411,6 @@ func (dir *Dir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp
|
||||
|
||||
func (dir *Dir) Forget() {
|
||||
glog.V(3).Infof("Forget dir %s", dir.FullPath())
|
||||
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(util.FullPath(dir.FullPath()))
|
||||
}
|
||||
|
||||
func (dir *Dir) maybeLoadEntry() error {
|
||||
@@ -478,9 +443,7 @@ func (dir *Dir) saveEntry() error {
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
dir.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -42,9 +42,7 @@ func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node,
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
if dir.wfs.option.AsyncMetaDataCaching {
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -38,14 +38,5 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
|
||||
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
dir.wfs.cacheDelete(newPath)
|
||||
dir.wfs.cacheDelete(oldPath)
|
||||
|
||||
// fmt.Printf("rename path: %v => %v\n", oldPath, newPath)
|
||||
dir.wfs.fsNodeCache.Move(oldPath, newPath)
|
||||
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
+1
-10
@@ -150,8 +150,6 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
|
||||
return nil
|
||||
}
|
||||
|
||||
file.wfs.cacheDelete(file.fullpath())
|
||||
|
||||
return file.saveEntry()
|
||||
|
||||
}
|
||||
@@ -168,8 +166,6 @@ func (file *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error
|
||||
return err
|
||||
}
|
||||
|
||||
file.wfs.cacheDelete(file.fullpath())
|
||||
|
||||
return file.saveEntry()
|
||||
|
||||
}
|
||||
@@ -186,8 +182,6 @@ func (file *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest)
|
||||
return err
|
||||
}
|
||||
|
||||
file.wfs.cacheDelete(file.fullpath())
|
||||
|
||||
return file.saveEntry()
|
||||
|
||||
}
|
||||
@@ -219,7 +213,6 @@ func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
func (file *File) Forget() {
|
||||
t := util.NewFullPath(file.dir.FullPath(), file.Name)
|
||||
glog.V(3).Infof("Forget file %s", t)
|
||||
file.wfs.fsNodeCache.DeleteFsNode(t)
|
||||
}
|
||||
|
||||
func (file *File) maybeLoadEntry(ctx context.Context) error {
|
||||
@@ -278,9 +271,7 @@ func (file *File) saveEntry() error {
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
if file.wfs.option.AsyncMetaDataCaching {
|
||||
file.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
file.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ package filesys
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -98,6 +99,10 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
|
||||
|
||||
totalRead, err := fh.f.reader.ReadAt(buff, offset)
|
||||
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("file handle read %s: %v", fh.f.fullpath(), err)
|
||||
}
|
||||
@@ -209,9 +214,7 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
return fmt.Errorf("fh flush create %s: %v", fh.f.fullpath(), err)
|
||||
}
|
||||
|
||||
if fh.f.wfs.option.AsyncMetaDataCaching {
|
||||
fh.f.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
}
|
||||
fh.f.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
|
||||
|
||||
fh.f.wfs.deleteFileChunks(garbages)
|
||||
for i, chunk := range garbages {
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
type FsCache struct {
|
||||
root *FsNode
|
||||
sync.RWMutex
|
||||
}
|
||||
type FsNode struct {
|
||||
parent *FsNode
|
||||
node fs.Node
|
||||
name string
|
||||
childrenLock sync.RWMutex
|
||||
children map[string]*FsNode
|
||||
}
|
||||
|
||||
func newFsCache(root fs.Node) *FsCache {
|
||||
return &FsCache{
|
||||
root: &FsNode{
|
||||
node: root,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *FsCache) GetFsNode(path util.FullPath) fs.Node {
|
||||
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
return c.doGetFsNode(path)
|
||||
}
|
||||
|
||||
func (c *FsCache) doGetFsNode(path util.FullPath) fs.Node {
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.findChild(p)
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return t.node
|
||||
}
|
||||
|
||||
func (c *FsCache) SetFsNode(path util.FullPath, node fs.Node) {
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
c.doSetFsNode(path, node)
|
||||
}
|
||||
|
||||
func (c *FsCache) doSetFsNode(path util.FullPath, node fs.Node) {
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.ensureChild(p)
|
||||
}
|
||||
t.node = node
|
||||
}
|
||||
|
||||
func (c *FsCache) EnsureFsNode(path util.FullPath, genNodeFn func() fs.Node) fs.Node {
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
t := c.doGetFsNode(path)
|
||||
if t != nil {
|
||||
return t
|
||||
}
|
||||
t = genNodeFn()
|
||||
c.doSetFsNode(path, t)
|
||||
return t
|
||||
}
|
||||
|
||||
func (c *FsCache) DeleteFsNode(path util.FullPath) {
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.findChild(p)
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if t.parent != nil {
|
||||
t.parent.disconnectChild(t)
|
||||
}
|
||||
t.deleteSelf()
|
||||
}
|
||||
|
||||
// oldPath and newPath are full path including the new name
|
||||
func (c *FsCache) Move(oldPath util.FullPath, newPath util.FullPath) *FsNode {
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
// find old node
|
||||
src := c.root
|
||||
for _, p := range oldPath.Split() {
|
||||
src = src.findChild(p)
|
||||
if src == nil {
|
||||
return src
|
||||
}
|
||||
}
|
||||
if src.parent != nil {
|
||||
src.parent.disconnectChild(src)
|
||||
}
|
||||
|
||||
// find new node
|
||||
target := c.root
|
||||
for _, p := range newPath.Split() {
|
||||
target = target.ensureChild(p)
|
||||
}
|
||||
parent := target.parent
|
||||
src.name = target.name
|
||||
if dir, ok := src.node.(*Dir); ok {
|
||||
dir.name = target.name // target is not Dir, but a shortcut
|
||||
}
|
||||
if f, ok := src.node.(*File); ok {
|
||||
f.Name = target.name
|
||||
if f.entry != nil {
|
||||
f.entry.Name = f.Name
|
||||
}
|
||||
}
|
||||
parent.disconnectChild(target)
|
||||
|
||||
target.deleteSelf()
|
||||
|
||||
src.connectToParent(parent)
|
||||
|
||||
return src
|
||||
}
|
||||
|
||||
func (n *FsNode) connectToParent(parent *FsNode) {
|
||||
n.parent = parent
|
||||
oldNode := parent.findChild(n.name)
|
||||
if oldNode != nil {
|
||||
oldNode.deleteSelf()
|
||||
}
|
||||
if dir, ok := n.node.(*Dir); ok {
|
||||
dir.parent = parent.node.(*Dir)
|
||||
}
|
||||
if f, ok := n.node.(*File); ok {
|
||||
f.dir = parent.node.(*Dir)
|
||||
}
|
||||
n.childrenLock.Lock()
|
||||
parent.children[n.name] = n
|
||||
n.childrenLock.Unlock()
|
||||
}
|
||||
|
||||
func (n *FsNode) findChild(name string) *FsNode {
|
||||
n.childrenLock.RLock()
|
||||
defer n.childrenLock.RUnlock()
|
||||
|
||||
child, found := n.children[name]
|
||||
if found {
|
||||
return child
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *FsNode) ensureChild(name string) *FsNode {
|
||||
n.childrenLock.Lock()
|
||||
defer n.childrenLock.Unlock()
|
||||
|
||||
if n.children == nil {
|
||||
n.children = make(map[string]*FsNode)
|
||||
}
|
||||
child, found := n.children[name]
|
||||
if found {
|
||||
return child
|
||||
}
|
||||
t := &FsNode{
|
||||
parent: n,
|
||||
node: nil,
|
||||
name: name,
|
||||
children: nil,
|
||||
}
|
||||
n.children[name] = t
|
||||
return t
|
||||
}
|
||||
|
||||
func (n *FsNode) disconnectChild(child *FsNode) {
|
||||
n.childrenLock.Lock()
|
||||
delete(n.children, child.name)
|
||||
n.childrenLock.Unlock()
|
||||
child.parent = nil
|
||||
}
|
||||
|
||||
func (n *FsNode) deleteSelf() {
|
||||
n.childrenLock.Lock()
|
||||
for _, child := range n.children {
|
||||
child.deleteSelf()
|
||||
}
|
||||
n.children = nil
|
||||
n.childrenLock.Unlock()
|
||||
|
||||
n.node = nil
|
||||
n.parent = nil
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func TestPathSplit(t *testing.T) {
|
||||
parts := util.FullPath("/").Split()
|
||||
if len(parts) != 0 {
|
||||
t.Errorf("expecting an empty list, but getting %d", len(parts))
|
||||
}
|
||||
|
||||
parts = util.FullPath("/readme.md").Split()
|
||||
if len(parts) != 1 {
|
||||
t.Errorf("expecting an empty list, but getting %d", len(parts))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFsCache(t *testing.T) {
|
||||
|
||||
cache := newFsCache(nil)
|
||||
|
||||
x := cache.GetFsNode(util.FullPath("/y/x"))
|
||||
if x != nil {
|
||||
t.Errorf("wrong node!")
|
||||
}
|
||||
|
||||
p := util.FullPath("/a/b/c")
|
||||
cache.SetFsNode(p, &File{Name: "cc"})
|
||||
tNode := cache.GetFsNode(p)
|
||||
tFile := tNode.(*File)
|
||||
if tFile.Name != "cc" {
|
||||
t.Errorf("expecting a FsNode")
|
||||
}
|
||||
|
||||
cache.SetFsNode(util.FullPath("/a/b/d"), &File{Name: "dd"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/e"), &File{Name: "ee"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/f"), &File{Name: "ff"})
|
||||
cache.SetFsNode(util.FullPath("/z"), &File{Name: "zz"})
|
||||
cache.SetFsNode(util.FullPath("/a"), &File{Name: "aa"})
|
||||
|
||||
b := cache.GetFsNode(util.FullPath("/a/b"))
|
||||
if b != nil {
|
||||
t.Errorf("unexpected node!")
|
||||
}
|
||||
|
||||
a := cache.GetFsNode(util.FullPath("/a"))
|
||||
if a == nil {
|
||||
t.Errorf("missing node!")
|
||||
}
|
||||
|
||||
cache.DeleteFsNode(util.FullPath("/a"))
|
||||
if b != nil {
|
||||
t.Errorf("unexpected node!")
|
||||
}
|
||||
|
||||
a = cache.GetFsNode(util.FullPath("/a"))
|
||||
if a != nil {
|
||||
t.Errorf("wrong DeleteFsNode!")
|
||||
}
|
||||
|
||||
z := cache.GetFsNode(util.FullPath("/z"))
|
||||
if z == nil {
|
||||
t.Errorf("missing node!")
|
||||
}
|
||||
|
||||
y := cache.GetFsNode(util.FullPath("/x/y"))
|
||||
if y != nil {
|
||||
t.Errorf("wrong node!")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFsCacheMove(t *testing.T) {
|
||||
|
||||
cache := newFsCache(nil)
|
||||
|
||||
cache.SetFsNode(util.FullPath("/a/b/d"), &File{Name: "dd"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/e"), &File{Name: "ee"})
|
||||
cache.SetFsNode(util.FullPath("/z"), &File{Name: "zz"})
|
||||
cache.SetFsNode(util.FullPath("/a"), &File{Name: "aa"})
|
||||
|
||||
cache.Move(util.FullPath("/a/b"), util.FullPath("/z/x"))
|
||||
|
||||
d := cache.GetFsNode(util.FullPath("/z/x/d"))
|
||||
if d == nil {
|
||||
t.Errorf("unexpected nil node!")
|
||||
}
|
||||
if d.(*File).Name != "dd" {
|
||||
t.Errorf("unexpected non dd node!")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,16 +9,19 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2/leveldb"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/bounded_tree"
|
||||
)
|
||||
|
||||
type MetaCache struct {
|
||||
actualStore filer2.FilerStore
|
||||
sync.RWMutex
|
||||
visitedBoundary *bounded_tree.BoundedTree
|
||||
}
|
||||
|
||||
func NewMetaCache(dbFolder string) *MetaCache {
|
||||
return &MetaCache{
|
||||
actualStore: openMetaStore(dbFolder),
|
||||
actualStore: openMetaStore(dbFolder),
|
||||
visitedBoundary: bounded_tree.NewBoundedTree(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +52,24 @@ func (mc *MetaCache) InsertEntry(ctx context.Context, entry *filer2.Entry) error
|
||||
func (mc *MetaCache) AtomicUpdateEntry(ctx context.Context, oldPath util.FullPath, newEntry *filer2.Entry) error {
|
||||
mc.Lock()
|
||||
defer mc.Unlock()
|
||||
if oldPath != "" {
|
||||
if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
|
||||
return err
|
||||
|
||||
oldDir, _ := oldPath.DirAndName()
|
||||
if mc.visitedBoundary.HasVisited(util.FullPath(oldDir)) {
|
||||
if oldPath != "" {
|
||||
if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// println("unknown old directory:", oldDir)
|
||||
}
|
||||
|
||||
if newEntry != nil {
|
||||
if err := mc.actualStore.InsertEntry(ctx, newEntry); err != nil {
|
||||
return err
|
||||
newDir, _ := newEntry.DirAndName()
|
||||
if mc.visitedBoundary.HasVisited(util.FullPath(newDir)) {
|
||||
if err := mc.actualStore.InsertEntry(ctx, newEntry); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -2,6 +2,7 @@ package meta_cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
@@ -10,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func InitMetaCache(mc *MetaCache, client filer_pb.FilerClient, path string) error {
|
||||
return nil
|
||||
glog.V(0).Infof("synchronizing meta data ...")
|
||||
filer_pb.TraverseBfs(client, util.FullPath(path), func(parentPath util.FullPath, pbEntry *filer_pb.Entry) {
|
||||
entry := filer2.FromPbEntry(string(parentPath), pbEntry)
|
||||
@@ -19,3 +21,27 @@ func InitMetaCache(mc *MetaCache, client filer_pb.FilerClient, path string) erro
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.FullPath) {
|
||||
|
||||
mc.visitedBoundary.EnsureVisited(dirPath, func(path util.FullPath) (childDirectories []string, err error) {
|
||||
|
||||
glog.V(2).Infof("ReadDirAllEntries %s ...", path)
|
||||
|
||||
err = filer_pb.ReadDirAllEntries(client, dirPath, "", func(pbEntry *filer_pb.Entry, isLast bool) error {
|
||||
entry := filer2.FromPbEntry(string(dirPath), pbEntry)
|
||||
if err := mc.InsertEntry(context.Background(), entry); err != nil {
|
||||
glog.V(0).Infof("read %s: %v", entry.FullPath, err)
|
||||
return err
|
||||
}
|
||||
if entry.IsDirectory() {
|
||||
childDirectories = append(childDirectories, entry.Name())
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
err = fmt.Errorf("list %s: %v", dirPath, err)
|
||||
}
|
||||
return
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
// https://github.com/bazil/fuse/issues/130
|
||||
|
||||
var _ = fs.NodeAccesser(&Dir{})
|
||||
func (dir *Dir) Access(ctx context.Context, req *fuse.AccessRequest) error {
|
||||
return fuse.ENOSYS
|
||||
}
|
||||
|
||||
var _ = fs.NodeAccesser(&File{})
|
||||
func (file *File) Access(ctx context.Context, req *fuse.AccessRequest) error {
|
||||
return fuse.ENOSYS
|
||||
}
|
||||
+15
-38
@@ -10,18 +10,19 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util/grace"
|
||||
"github.com/karlseguin/ccache"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util/grace"
|
||||
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filesys/meta_cache"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/chunk_cache"
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
type Option struct {
|
||||
@@ -47,7 +48,6 @@ type Option struct {
|
||||
|
||||
OutsideContainerClusterMode bool // whether the mount runs outside SeaweedFS containers
|
||||
Cipher bool // whether encrypt data on volume server
|
||||
AsyncMetaDataCaching bool // whether asynchronously cache meta data
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ var _ = fs.FSStatfser(&WFS{})
|
||||
|
||||
type WFS struct {
|
||||
option *Option
|
||||
listDirectoryEntriesCache *ccache.Cache
|
||||
|
||||
// contains all open handles, protected by handlesLock
|
||||
handlesLock sync.Mutex
|
||||
@@ -67,7 +66,6 @@ type WFS struct {
|
||||
stats statsCache
|
||||
|
||||
root fs.Node
|
||||
fsNodeCache *FsCache
|
||||
|
||||
chunkCache *chunk_cache.ChunkCache
|
||||
metaCache *meta_cache.MetaCache
|
||||
@@ -80,7 +78,6 @@ type statsCache struct {
|
||||
func NewSeaweedFileSystem(option *Option) *WFS {
|
||||
wfs := &WFS{
|
||||
option: option,
|
||||
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(option.DirListCacheLimit * 3).ItemsToPrune(100)),
|
||||
handles: make(map[uint64]*FileHandle),
|
||||
bufPool: sync.Pool{
|
||||
New: func() interface{} {
|
||||
@@ -89,26 +86,24 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
||||
},
|
||||
}
|
||||
if option.CacheSizeMB > 0 {
|
||||
os.MkdirAll(option.CacheDir, 0755)
|
||||
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
|
||||
grace.OnInterrupt(func() {
|
||||
wfs.chunkCache.Shutdown()
|
||||
})
|
||||
}
|
||||
if wfs.option.AsyncMetaDataCaching {
|
||||
wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.CacheDir, "meta"))
|
||||
startTime := time.Now()
|
||||
if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil {
|
||||
glog.V(0).Infof("failed to init meta cache: %v", err)
|
||||
} else {
|
||||
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
|
||||
grace.OnInterrupt(func() {
|
||||
wfs.metaCache.Shutdown()
|
||||
})
|
||||
}
|
||||
wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.CacheDir, "meta"))
|
||||
startTime := time.Now()
|
||||
if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil {
|
||||
glog.V(0).Infof("failed to init meta cache: %v", err)
|
||||
} else {
|
||||
go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano())
|
||||
grace.OnInterrupt(func() {
|
||||
wfs.metaCache.Shutdown()
|
||||
})
|
||||
}
|
||||
|
||||
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs}
|
||||
wfs.fsNodeCache = newFsCache(wfs.root)
|
||||
|
||||
return wfs
|
||||
}
|
||||
@@ -228,24 +223,6 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wfs *WFS) cacheGet(path util.FullPath) *filer_pb.Entry {
|
||||
item := wfs.listDirectoryEntriesCache.Get(string(path))
|
||||
if item != nil && !item.Expired() {
|
||||
return item.Value().(*filer_pb.Entry)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (wfs *WFS) cacheSet(path util.FullPath, entry *filer_pb.Entry, ttl time.Duration) {
|
||||
if entry == nil {
|
||||
wfs.listDirectoryEntriesCache.Delete(string(path))
|
||||
} else {
|
||||
wfs.listDirectoryEntriesCache.Set(string(path), entry, ttl)
|
||||
}
|
||||
}
|
||||
func (wfs *WFS) cacheDelete(path util.FullPath) {
|
||||
wfs.listDirectoryEntriesCache.Delete(string(path))
|
||||
}
|
||||
|
||||
func (wfs *WFS) AdjustedUrl(hostAndPort string) string {
|
||||
if !wfs.option.OutsideContainerClusterMode {
|
||||
return hostAndPort
|
||||
|
||||
+8
-36
@@ -3,10 +3,11 @@ package filesys
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/fuse"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filesys/meta_cache"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
)
|
||||
|
||||
func getxattr(entry *filer_pb.Entry, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error {
|
||||
@@ -110,43 +111,14 @@ func listxattr(entry *filer_pb.Entry, req *fuse.ListxattrRequest, resp *fuse.Lis
|
||||
func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err error) {
|
||||
|
||||
fullpath := util.NewFullPath(dir, name)
|
||||
entry = wfs.cacheGet(fullpath)
|
||||
if entry != nil {
|
||||
return
|
||||
}
|
||||
// glog.V(3).Infof("read entry cache miss %s", fullpath)
|
||||
|
||||
// read from async meta cache
|
||||
if wfs.option.AsyncMetaDataCaching {
|
||||
cachedEntry, cacheErr := wfs.metaCache.FindEntry(context.Background(), fullpath)
|
||||
if cacheErr == filer_pb.ErrNotFound {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
return cachedEntry.ToProtoEntry(), nil
|
||||
meta_cache.EnsureVisited(wfs.metaCache, wfs, util.FullPath(dir))
|
||||
cachedEntry, cacheErr := wfs.metaCache.FindEntry(context.Background(), fullpath)
|
||||
if cacheErr == filer_pb.ErrNotFound {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
return cachedEntry.ToProtoEntry(), nil
|
||||
|
||||
err = wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Name: name,
|
||||
Directory: dir,
|
||||
}
|
||||
|
||||
resp, err := filer_pb.LookupEntry(client, request)
|
||||
if err != nil {
|
||||
if err == filer_pb.ErrNotFound {
|
||||
glog.V(3).Infof("file attr read not found file %v: %v", request, err)
|
||||
return fuse.ENOENT
|
||||
}
|
||||
glog.V(3).Infof("attr read %v: %v", request, err)
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
entry = resp.Entry
|
||||
wfs.cacheSet(fullpath, entry, wfs.option.EntryCacheTtl)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*
|
||||
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
||||
tp := broker.TopicPartition{
|
||||
Namespace: namespace,
|
||||
Topic: topic,
|
||||
Topic: topic,
|
||||
Partition: int32(i),
|
||||
}
|
||||
grpcClientConn, err := mc.findBroker(tp)
|
||||
|
||||
@@ -3,8 +3,8 @@ package msgclient
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"time"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/messaging/broker"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
|
||||
@@ -26,12 +26,12 @@ func (mc *MessagingClient) NewSubscriber(subscriberId, namespace, topic string,
|
||||
subscriberCancels := make([]context.CancelFunc, topicConfiguration.PartitionCount)
|
||||
|
||||
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
||||
if partitionId>=0 && i != partitionId {
|
||||
if partitionId >= 0 && i != partitionId {
|
||||
continue
|
||||
}
|
||||
tp := broker.TopicPartition{
|
||||
Namespace: namespace,
|
||||
Topic: topic,
|
||||
Topic: topic,
|
||||
Partition: int32(i),
|
||||
}
|
||||
grpcClientConn, err := mc.findBroker(tp)
|
||||
|
||||
@@ -283,6 +283,7 @@ message ListMasterClientsResponse {
|
||||
message LeaseAdminTokenRequest {
|
||||
int64 previous_token = 1;
|
||||
int64 previous_lock_time = 2;
|
||||
string lock_name = 3;
|
||||
}
|
||||
message LeaseAdminTokenResponse {
|
||||
int64 token = 1;
|
||||
@@ -292,6 +293,7 @@ message LeaseAdminTokenResponse {
|
||||
message ReleaseAdminTokenRequest {
|
||||
int64 previous_token = 1;
|
||||
int64 previous_lock_time = 2;
|
||||
string lock_name = 3;
|
||||
}
|
||||
message ReleaseAdminTokenResponse {
|
||||
}
|
||||
+166
-149
@@ -1478,8 +1478,9 @@ func (m *ListMasterClientsResponse) GetGrpcAddresses() []string {
|
||||
}
|
||||
|
||||
type LeaseAdminTokenRequest struct {
|
||||
PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"`
|
||||
PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"`
|
||||
PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"`
|
||||
PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"`
|
||||
LockName string `protobuf:"bytes,3,opt,name=lock_name,json=lockName" json:"lock_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LeaseAdminTokenRequest) Reset() { *m = LeaseAdminTokenRequest{} }
|
||||
@@ -1501,6 +1502,13 @@ func (m *LeaseAdminTokenRequest) GetPreviousLockTime() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LeaseAdminTokenRequest) GetLockName() string {
|
||||
if m != nil {
|
||||
return m.LockName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LeaseAdminTokenResponse struct {
|
||||
Token int64 `protobuf:"varint,1,opt,name=token" json:"token,omitempty"`
|
||||
LockTsNs int64 `protobuf:"varint,2,opt,name=lock_ts_ns,json=lockTsNs" json:"lock_ts_ns,omitempty"`
|
||||
@@ -1526,8 +1534,9 @@ func (m *LeaseAdminTokenResponse) GetLockTsNs() int64 {
|
||||
}
|
||||
|
||||
type ReleaseAdminTokenRequest struct {
|
||||
PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"`
|
||||
PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"`
|
||||
PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"`
|
||||
PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"`
|
||||
LockName string `protobuf:"bytes,3,opt,name=lock_name,json=lockName" json:"lock_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ReleaseAdminTokenRequest) Reset() { *m = ReleaseAdminTokenRequest{} }
|
||||
@@ -1549,6 +1558,13 @@ func (m *ReleaseAdminTokenRequest) GetPreviousLockTime() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ReleaseAdminTokenRequest) GetLockName() string {
|
||||
if m != nil {
|
||||
return m.LockName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReleaseAdminTokenResponse struct {
|
||||
}
|
||||
|
||||
@@ -2138,150 +2154,151 @@ var _Seaweed_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("master.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 2320 bytes of a gzipped FileDescriptorProto
|
||||
// 2334 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x59, 0x4b, 0x6f, 0x1c, 0xc7,
|
||||
0xf1, 0xd7, 0xee, 0xf2, 0xb1, 0x5b, 0xcb, 0x7d, 0x35, 0x29, 0x6a, 0xb9, 0x7a, 0x90, 0x1a, 0xdb,
|
||||
0x30, 0xa5, 0xbf, 0xff, 0x8c, 0x43, 0x1b, 0x88, 0x11, 0xc7, 0x30, 0x28, 0x8a, 0x56, 0x08, 0x91,
|
||||
0xb4, 0x34, 0x64, 0x64, 0xc0, 0x40, 0x30, 0xee, 0x9d, 0x69, 0x52, 0x03, 0xce, 0x2b, 0xd3, 0xbd,
|
||||
0x14, 0xd7, 0xb9, 0x04, 0xc8, 0x31, 0xa7, 0x20, 0x87, 0x7c, 0x85, 0x5c, 0x72, 0x4a, 0xce, 0xbe,
|
||||
0xe4, 0x1b, 0xe5, 0x92, 0x83, 0x2f, 0x41, 0xbf, 0x66, 0x7a, 0x66, 0x77, 0x49, 0xd3, 0x80, 0x03,
|
||||
0xe8, 0x36, 0x5d, 0x55, 0x5d, 0x5d, 0xf3, 0xab, 0xee, 0xaa, 0x5f, 0xcf, 0xc0, 0x52, 0x88, 0x29,
|
||||
0x23, 0xe9, 0x56, 0x92, 0xc6, 0x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bf, 0x25, 0x4e, 0xe0, 0x87, 0x3e, 0x13, 0x87, 0x64, 0xce, 0xee, 0x48, 0xc5, 0xb1,
|
||||
0xff, 0x2d, 0x39, 0xe0, 0x62, 0xb4, 0x0a, 0x0b, 0x01, 0xc1, 0x1e, 0x49, 0xc5, 0x99, 0x69, 0xd8,
|
||||
0x6a, 0x84, 0xde, 0x87, 0x4e, 0x48, 0x58, 0xea, 0xbb, 0xd4, 0xc1, 0x9e, 0x97, 0x12, 0x4a, 0xd5,
|
||||
0xd1, 0x69, 0x2b, 0xf1, 0x8e, 0x94, 0xa2, 0x4f, 0xa0, 0xaf, 0x0d, 0x7d, 0xbe, 0xc7, 0x2f, 0x70,
|
||||
0xe0, 0x50, 0xe2, 0xc6, 0x91, 0x47, 0xd5, 0x39, 0x5a, 0x55, 0xfa, 0x7d, 0xa5, 0x3e, 0x96, 0x5a,
|
||||
0xf4, 0x14, 0xba, 0x94, 0xc5, 0x29, 0x3e, 0x23, 0xce, 0x10, 0xbb, 0xe7, 0x84, 0xcf, 0x98, 0x17,
|
||||
0xe0, 0xad, 0x19, 0xe0, 0x1d, 0x4b, 0x93, 0x27, 0xd2, 0xc2, 0xee, 0xd0, 0xc2, 0x98, 0x5a, 0xdf,
|
||||
0xd7, 0xa0, 0x3f, 0xeb, 0x18, 0x88, 0xfa, 0xe0, 0x89, 0x57, 0x6f, 0xd9, 0x55, 0xdf, 0xe3, 0xe7,
|
||||
0x8f, 0x43, 0x22, 0xde, 0x75, 0xce, 0x16, 0xcf, 0xe8, 0x01, 0x80, 0x1b, 0x07, 0x01, 0x71, 0xf9,
|
||||
0x44, 0xf5, 0x92, 0x86, 0x84, 0x9f, 0x4f, 0x71, 0xe4, 0xf3, 0xd2, 0x30, 0x67, 0x37, 0xb8, 0x44,
|
||||
0x56, 0x85, 0x87, 0xb0, 0x24, 0xd3, 0xa7, 0x0c, 0x64, 0x55, 0x68, 0x4a, 0x99, 0x34, 0xf9, 0x00,
|
||||
0x90, 0xde, 0x26, 0xc3, 0x71, 0x66, 0xb8, 0x20, 0x0c, 0xbb, 0x4a, 0xf3, 0x64, 0xac, 0xad, 0xef,
|
||||
0x42, 0x23, 0x25, 0xd8, 0x73, 0xe2, 0x28, 0x18, 0x8b, 0x42, 0x51, 0xb7, 0xeb, 0x5c, 0xf0, 0x65,
|
||||
0x14, 0x8c, 0xd1, 0xff, 0x41, 0x2f, 0x25, 0x49, 0xe0, 0xbb, 0xd8, 0x49, 0x02, 0xec, 0x92, 0x90,
|
||||
0x44, 0xba, 0x66, 0x74, 0x95, 0xe2, 0x85, 0x96, 0xa3, 0x3e, 0x2c, 0x5e, 0x90, 0x94, 0xf2, 0xd7,
|
||||
0x6a, 0x08, 0x13, 0x3d, 0x44, 0x5d, 0xa8, 0x31, 0x16, 0xf4, 0x41, 0x48, 0xf9, 0x23, 0x7a, 0x04,
|
||||
0x5d, 0x37, 0x0e, 0x13, 0xec, 0x32, 0x27, 0x25, 0x17, 0xbe, 0x98, 0xd4, 0x14, 0xea, 0x8e, 0x92,
|
||||
0xdb, 0x4a, 0xcc, 0x5f, 0x27, 0x8c, 0x3d, 0xff, 0xd4, 0x27, 0x9e, 0x83, 0x99, 0x4a, 0xb6, 0x38,
|
||||
0xb8, 0x35, 0xbb, 0xab, 0x35, 0x3b, 0x4c, 0xa6, 0x19, 0x6d, 0xc1, 0x72, 0x4a, 0xc2, 0x98, 0x11,
|
||||
0x47, 0x27, 0x3b, 0xc2, 0x21, 0xe9, 0xb7, 0x04, 0xce, 0x3d, 0xa9, 0x52, 0x39, 0x3e, 0xc2, 0x21,
|
||||
0xe1, 0xde, 0x4b, 0xf6, 0xbc, 0xd6, 0xb6, 0x85, 0x79, 0xb7, 0x60, 0xfe, 0x9c, 0x8c, 0xad, 0xbf,
|
||||
0x55, 0xe0, 0xfe, 0x95, 0x25, 0x67, 0x62, 0x0b, 0x5c, 0x97, 0xee, 0x9f, 0x0a, 0x61, 0x6b, 0x04,
|
||||
0xeb, 0xd7, 0x14,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4e, 0x7d, 0x36, 0x56, 0x44, 0x43, 0x8d, 0x78, 0xa9, 0x50, 0x85, 0xd7, 0xf7, 0x24, 0x68,
|
||||
0x2d, 0xbb, 0x21, 0x25, 0xfb, 0x1e, 0xb5, 0x9e, 0xc1, 0xca, 0x73, 0x42, 0x92, 0xdd, 0x38, 0x8a,
|
||||
0x88, 0xcb, 0x88, 0x67, 0x93, 0xdf, 0x8d, 0x08, 0x65, 0x7c, 0x09, 0x71, 0x26, 0x54, 0x3e, 0xf8,
|
||||
0x33, 0xaf, 0x02, 0x67, 0x69, 0xe2, 0x3a, 0x06, 0x9d, 0xa9, 0x73, 0x01, 0xe7, 0x04, 0xd6, 0x5f,
|
||||
0x2b, 0xd0, 0x96, 0x7b, 0xe9, 0x20, 0x76, 0xc5, 0x0e, 0xe2, 0x88, 0x72, 0x7a, 0xa3, 0x10, 0x1d,
|
||||
0xa5, 0x41, 0x89, 0xf7, 0x54, 0xcb, 0xbc, 0x67, 0x0d, 0xea, 0x82, 0x18, 0xe4, 0x91, 0x2e, 0xf2,
|
||||
0x5e, 0xef, 0x7b, 0x34, 0x2f, 0x69, 0x9e, 0x54, 0xcf, 0x09, 0x75, 0x53, 0xf7, 0x6e, 0x6e, 0x92,
|
||||
0xb7, 0x8d, 0x79, 0xb3, 0x6d, 0x58, 0x27, 0xb0, 0x7c, 0x10, 0xc7, 0xe7, 0xa3, 0x44, 0x86, 0xa7,
|
||||
0xdf, 0xb0, 0x08, 0x4c, 0x65, 0xa3, 0xc6, 0x63, 0xc9, 0x80, 0xb9, 0x6e, 0x9f, 0x5b, 0xff, 0xae,
|
||||
0xc0, 0x4a, 0xd1, 0xad, 0xea, 0x74, 0xdf, 0xc0, 0x72, 0xe6, 0xd7, 0x09, 0x14, 0x16, 0x72, 0x81,
|
||||
0xe6, 0xf6, 0x87, 0xc6, 0x1e, 0x98, 0x36, 0x5b, 0xb3, 0x27, 0x4f, 0x83, 0x68, 0xf7, 0x2e, 0x4a,
|
||||
0x12,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
||||
0x45, 0x75, 0x56, 0x2e, 0x26, 0x6e, 0x18, 0x19, 0xf2, 0x73, 0x26, 0xf2, 0x59, 0xd2, 0xe7, 0x8d,
|
||||
0xa4, 0x73, 0x68, 0xf0, 0x88, 0xbd, 0xd6, 0xd0, 0xf0, 0x67, 0xeb, 0x0c, 0x7a, 0xc7, 0x0c, 0x33,
|
||||
0x9f, 0x32, 0xdf, 0xa5, 0x3a, 0x9d, 0xa5, 0xc4, 0x55, 0xae, 0x4b, 0x5c, 0x75, 0x56, 0xe2, 0x6a,
|
||||
0x59, 0xe2, 0xac, 0x7f, 0x55, 0x00, 0x99, 0x2b, 0x29, 0x08, 0x7e, 0x82, 0xa5, 0x38, 0x64, 0x2c,
|
||||
0x66, 0x9c, 0x2a, 0x72, 0x3a, 0xa6, 0x48, 0x95, 0x90, 0xf0, 0xf4, 0xf1, 0xdd, 0x30, 0xa2, 0xc4,
|
||||
0x93, 0x5a, 0xc9, 0xa8, 0xea, 0x5c, 0x20, 0x94, 0x45, 0x42, 0xb6, 0x50, 0x22, 0x64, 0xd6, 0x0e,
|
||||
0x34, 0x55, 0x73, 0x3a, 0xe1, 0x8d, 0xed, 0xfa, 0xe8, 0x55, 0x74, 0xd5, 0x1c, 0x88, 0x0d, 0x80,
|
||||
0xdd, 0x3c, 0xfa, 0x29, 0xe5, 0xd9, 0xfa, 0x3d, 0xdc, 0xce, 0x2d, 0x0e, 0x7c, 0xca, 0x74, 0x5e,
|
||||
0x3e, 0x86, 0x55, 0x3f, 0x72, 0x83, 0x91, 0x47, 0x9c, 0x88, 0xb7, 0xf7, 0x20, 0xbb, 0xd9, 0x54,
|
||||
0x04, 0x95, 0x5b, 0x51, 0xda, 0x23, 0xa1, 0xd4, 0x37, 0x9c, 0x0f, 0x00, 0xe9, 0x59, 0xc4, 0xcd,
|
||||
0x66, 0x54, 0xc5, 0x8c, 0xae, 0xd2, 0xec, 0xb9, 0xca, 0xda, 0x7a, 0x09, 0xab, 0xe5, 0xc5, 0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, 0x2d, 0xaa, 0x89, 0x3f, 0x82,
|
||||
0xd8, 0x5b, 0xeb, 0x70, 0xff, 0x19, 0x61, 0x87, 0xc2, 0x66, 0x37, 0x8e, 0x4e, 0xfd, 0xb3, 0x51,
|
||||
0x2a, 0x8d, 0xf2, 0xd4, 0x3e, 0x98, 0x65, 0xa1, 0x60, 0x9a, 0xf2, 0x21, 0xae, 0x72, 0xe3, 0x0f,
|
||||
0x71, 0xd5, 0xab, 0x3e, 0xc4, 0x59, 0x9f, 0x42, 0x9f, 0xef, 0x2c, 0x15, 0x45, 0xe0, 0x93, 0x88,
|
||||
0x65, 0x3c, 0x73, 0x1d, 0x9a, 0xae, 0x90, 0x38, 0xc6, 0x27, 0x03, 0x90, 0x22, 0xce, 0xaf, 0xac,
|
||||
0x27, 0xb0, 0x36, 0x65, 0xb2, 0x0a, 0xfe, 0x3d, 0x68, 0x8b, 0x5b, 0xac, 0x8a, 0x9c, 0xe8, 0xbb,
|
||||
0x5f, 0x8b, 0x4b, 0x77, 0xb4, 0xd0, 0x0a, 0x61, 0xf5, 0x80, 0x60, 0x4a, 0x76, 0xbc, 0xd0, 0x8f,
|
||||
0x4e, 0xe2, 0x73, 0x92, 0xdd, 0x5a, 0xde, 0x83, 0x76, 0x92, 0x92, 0x0b, 0x3f, 0x1e, 0x51, 0x87,
|
||||
0x71, 0x85, 0x88, 0xa0, 0x66, 0xb7, 0xb4, 0x54, 0x58, 0x73, 0xfe, 0x94, 0x99, 0xf1, 0x8b, 0xbe,
|
||||
0xc3, 0xfc, 0x50, 0x7e, 0x4a, 0xa8, 0xd9, 0x5d, 0xad, 0x39, 0x88, 0xdd, 0xf3, 0x13, 0x3f, 0x24,
|
||||
0xd6, 0x21, 0xdc, 0x99, 0x58, 0x4e, 0x05, 0xbc, 0x02, 0xf3, 0xe6, 0x32, 0x72, 0x80, 0xee, 0x01,
|
||||
0x48, 0xaf, 0xd4, 0x89, 0xa8, 0x72, 0x5b, 0xe7, 0x92, 0x13, 0x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, 0x4d, 0x4a, 0x82, 0x50, 0x2c, 0xd2, 0x05, 0x10,
|
||||
0xa6, 0xb6, 0x94, 0x02, 0x08, 0xd3, 0x2b, 0xbc, 0x75, 0x0b, 0xc5, 0xb0, 0x3a, 0xbd, 0x74, 0x22,
|
||||
0xf3, 0xe3, 0xdf, 0x95, 0xf5, 0x77, 0xf0, 0xe8, 0x07, 0x58, 0x66, 0x0b, 0x7e, 0x03, 0xbd, 0x89,
|
||||
0x4a, 0x87, 0x4c, 0x48, 0x67, 0x15, 0xd1, 0xc1, 0xbb, 0x57, 0x1b, 0x65, 0x2b, 0x7c, 0x0d, 0x9d,
|
||||
0x52, 0x61, 0x42, 0x05, 0x28, 0xa6, 0xd6, 0x98, 0x81, 0x75, 0x95, 0x89, 0x19, 0xfd, 0x44, 0xd1,
|
||||
0x28, 0x44, 0x3f, 0xab, 0x86, 0x15, 0xa2, 0x9f, 0x59, 0x77, 0xac, 0x5b, 0xc3, 0x05, 0xf1, 0xb3,
|
||||
0xf6, 0xa3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x7a, 0x09, 0x55, 0xbc, 0x1d, 0x00, 0x00,
|
||||
0x11, 0xd6, 0xec, 0xf2, 0xb1, 0x5b, 0xcb, 0x7d, 0x35, 0x29, 0x6a, 0xb9, 0x7a, 0x90, 0x1a, 0xdb,
|
||||
0x30, 0xa5, 0x38, 0x8c, 0x43, 0x1b, 0x88, 0x11, 0xc7, 0x30, 0x28, 0x8a, 0x56, 0x08, 0x89, 0xb4,
|
||||
0x34, 0x64, 0x64, 0xc0, 0x40, 0x30, 0xee, 0x9d, 0x69, 0x52, 0x03, 0xce, 0x2b, 0xd3, 0xbd, 0x14,
|
||||
0xd7, 0xb9, 0x04, 0xc8, 0x2d, 0xc9, 0x25, 0xc8, 0x21, 0x7f, 0x21, 0x97, 0x9c, 0x92, 0xb3, 0x2f,
|
||||
0xf9, 0x47, 0xb9, 0xe4, 0xe0, 0x4b, 0xd0, 0xaf, 0x99, 0x9e, 0x7d, 0x90, 0xa6, 0x01, 0x03, 0xd6,
|
||||
0x6d, 0xa6, 0xaa, 0xba, 0xba, 0xfa, 0xab, 0xee, 0xaa, 0xaf, 0x67, 0x60, 0x29, 0xc2, 0x94, 0x91,
|
||||
0x6c, 0x2b, 0xcd, 0x12, 0x96, 0xa0, 0xba, 0x7c, 0x73, 0xd3, 0x81, 0xfd, 0xe7, 0x05, 0xa8, 0xff,
|
||||
0x9a, 0xe0, 0x8c, 0x0d, 0x08, 0x66, 0xa8, 0x05, 0x95, 0x20, 0xed, 0x59, 0x1b, 0xd6, 0x66, 0xdd,
|
||||
0xa9, 0x04, 0x29, 0x42, 0x30, 0x97, 0x26, 0x19, 0xeb, 0x55, 0x36, 0xac, 0xcd, 0xa6, 0x23, 0x9e,
|
||||
0xd1, 0x5d, 0x80, 0x74, 0x38, 0x08, 0x03, 0xcf, 0x1d, 0x66, 0x61, 0xaf, 0x2a, 0x6c, 0xeb, 0x52,
|
||||
0xf2, 0x9b, 0x2c, 0x44, 0x9b, 0xd0, 0x89, 0xf0, 0x85, 0x7b, 0x9e, 0x84, 0xc3, 0x88, 0xb8, 0x5e,
|
||||
0x32, 0x8c, 0x59, 0x6f, 0x4e, 0x0c, 0x6f, 0x45, 0xf8, 0xe2, 0xa5, 0x10, 0xef, 0x72, 0x29, 0xda,
|
||||
0xe0, 0x51, 0x5d, 0xb8, 0x27, 0x41, 0x48, 0xdc, 0x33, 0x32, 0xea, 0xcd, 0x6f, 0x58, 0x9b, 0x73,
|
||||
0x0e, 0x44, 0xf8, 0xe2, 0xb3, 0x20, 0x24, 0x4f, 0xc9, 0x08, 0xad, 0x43, 0xc3, 0xc7, 0x0c, 0xbb,
|
||||
0x1e, 0x89, 0x19, 0xc9, 0x7a, 0x0b, 0x62, 0x2e, 0xe0, 0xa2, 0x5d, 0x21, 0xe1, 0xf1, 0x65, 0xd8,
|
||||
0x3b, 0xeb, 0x2d, 0x0a, 0x8d, 0x78, 0xe6, 0xf1, 0x61, 0x3f, 0x0a, 0x62, 0x57, 0x44, 0x5e, 0x13,
|
||||
0x53, 0xd7, 0x85, 0xe4, 0x39, 0x0f, 0xff, 0x13, 0x58, 0x94, 0xb1, 0xd1, 0x5e, 0x7d, 0xa3, 0xba,
|
||||
0xd9, 0xd8, 0x7e, 0x6b, 0x2b, 0x47, 0x63, 0x4b, 0x86, 0xb7, 0x1f, 0x9f, 0x24, 0x59, 0x84, 0x59,
|
||||
0x90, 0xc4, 0x07, 0x84, 0x52, 0x7c, 0x4a, 0x1c, 0x3d, 0x06, 0xed, 0x43, 0x23, 0x26, 0xaf, 0x5d,
|
||||
0xed, 0x02, 0x84, 0x8b, 0xcd, 0x09, 0x17, 0x47, 0xaf, 0x92, 0x8c, 0x4d, 0xf1, 0x03, 0x31, 0x79,
|
||||
0xfd, 0x52, 0xb9, 0x7a, 0x01, 0x6d, 0x9f, 0x84, 0x84, 0x11, 0x3f, 0x77, 0xd7, 0xb8, 0xa6, 0xbb,
|
||||
0x96, 0x72, 0xa0, 0x5d, 0xbe, 0x0d, 0xad, 0x57, 0x98, 0xba, 0x71, 0x92, 0x7b, 0x5c, 0xda, 0xb0,
|
||||
0x36, 0x6b, 0xce, 0xd2, 0x2b, 0x4c, 0x0f, 0x13, 0x6d, 0xf5, 0x04, 0xea, 0xc4, 0x73, 0xe9, 0x2b,
|
||||
0x9c, 0xf9, 0xb4, 0xd7, 0x11, 0x53, 0x3e, 0x9c, 0x98, 0x72, 0xcf, 0x3b, 0xe2, 0x06, 0x53, 0x26,
|
||||
0xad, 0x11, 0xa9, 0xa2, 0xe8, 0x10, 0x9a, 0x1c, 0x8c, 0xc2, 0x59, 0xf7, 0xda, 0xce, 0x38, 0x9a,
|
||||
0x7b, 0xda, 0xdf, 0x4b, 0xe8, 0x6a, 0x44, 0x0a, 0x9f, 0xe8, 0xda, 0x3e, 0x35, 0xac, 0xb9, 0xdf,
|
||||
0x77, 0xa1, 0xa3, 0x60, 0x29, 0xdc,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0x7c, 0x8a, 0x23, 0x5f, 0x94, 0x86, 0x39, 0xa7, 0xce, 0x25, 0xb2, 0x2a,
|
||||
0xdc, 0x87, 0x25, 0x99, 0x3e, 0x65, 0x20, 0xab, 0x42, 0x43, 0xca, 0xa4, 0xc9, 0x7b, 0x80, 0xf4,
|
||||
0x36, 0x19, 0x8c, 0x72, 0xc3, 0x05, 0x61, 0xd8, 0x51, 0x9a, 0x47, 0x23, 0x6d, 0x7d, 0x1b, 0xea,
|
||||
0x19, 0xc1, 0xbe, 0x9b, 0xc4, 0xe1, 0x48, 0x14, 0x8a, 0x9a, 0x53, 0xe3, 0x82, 0xcf, 0xe3, 0x70,
|
||||
0x84, 0x7e, 0x02, 0xdd, 0x8c, 0xa4, 0x61, 0xe0, 0x61, 0x37, 0x0d, 0xb1, 0x47, 0x22, 0x12, 0xeb,
|
||||
0x9a, 0xd1, 0x51, 0x8a, 0xe7, 0x5a, 0x8e, 0x7a, 0xb0, 0x78, 0x4e, 0x32, 0xca, 0x97, 0x55, 0x17,
|
||||
0x26, 0xfa, 0x15, 0x75, 0xa0, 0xca, 0x58, 0xd8, 0x03, 0x21, 0xe5, 0x8f, 0xe8, 0x01, 0x74, 0xbc,
|
||||
0x24, 0x4a, 0xb1, 0xc7, 0xdc, 0x8c, 0x9c, 0x07, 0x62, 0x50, 0x43, 0xa8, 0xdb, 0x4a, 0xee, 0x28,
|
||||
0x31, 0x5f, 0x4e, 0x94, 0xf8, 0xc1, 0x49, 0x40, 0x7c, 0x17, 0x33, 0x95, 0x6c, 0x71, 0x70, 0xab,
|
||||
0x4e, 0x47, 0x6b, 0x76, 0x98, 0x4c, 0x33, 0xda, 0x82, 0xe5, 0x8c, 0x44, 0x09, 0x23, 0xae, 0x4e,
|
||||
0x76, 0x8c, 0x23, 0xd2, 0x6b, 0x0a, 0x9c, 0xbb, 0x52, 0xa5, 0x72, 0x7c, 0x88, 0x23, 0xc2, 0xbd,
|
||||
0x8f, 0xd9, 0xf3, 0x5a, 0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, 0x36, 0x66, 0x6b, 0x4f, 0x0e, 0xd8, 0x15, 0xf6, 0x4e, 0x93, 0x98, 0xaf, 0xfd,
|
||||
0x2f, 0xa1, 0x59, 0xd2, 0x73, 0xb0, 0x78, 0x03, 0x57, 0x59, 0x11, 0xcf, 0xbc, 0x68, 0xa6, 0x38,
|
||||
0x0b, 0xd8, 0x48, 0x11, 0x0d, 0xf5, 0xc6, 0x4b, 0x85, 0x2a, 0xbc, 0x81, 0x2f, 0x41, 0x6b, 0x3a,
|
||||
0x75, 0x29, 0xd9, 0xf7, 0xa9, 0xfd, 0x04, 0x56, 0x9e, 0x12, 0x92, 0xee, 0x26, 0x71, 0x4c, 0x3c,
|
||||
0x46, 0x7c, 0x87, 0xfc, 0x6e, 0x48, 0x28, 0xe3, 0x53, 0x88, 0x33, 0xa1, 0xf2, 0xc1, 0x9f, 0x79,
|
||||
0x15, 0x38, 0xcd, 0x52, 0xcf, 0x35, 0xe8, 0x4c, 0x8d, 0x0b, 0x38, 0x27, 0xb0, 0xff, 0x6e, 0x41,
|
||||
0x4b, 0xee, 0xa5, 0x67, 0x89, 0x27, 0x76, 0x10, 0x47, 0x94, 0xd3, 0x1b, 0x85, 0xe8, 0x30, 0x0b,
|
||||
0xc7, 0x78, 0x4f, 0x65, 0x9c, 0xf7, 0xac, 0x41, 0x4d, 0x10, 0x83, 0x22, 0xd2, 0x45, 0xde, 0xeb,
|
||||
0x03, 0x9f, 0x16, 0x25, 0xcd, 0x97, 0xea, 0x39, 0xa1, 0x6e, 0xe8, 0xde, 0xcd, 0x4d, 0x8a, 0xb6,
|
||||
0x31, 0x6f, 0xb6, 0x0d, 0xfb, 0x18, 0x96, 0x9f, 0x25, 0xc9, 0xd9, 0x30, 0x95, 0xe1, 0xe9, 0x15,
|
||||
0x96, 0x81, 0xb1, 0x36, 0xaa, 0x3c, 0x96, 0x1c, 0x98, 0xab, 0xf6, 0xb9, 0xfd, 0x5f, 0x0b, 0x56,
|
||||
0xca, 0x6e, 0x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 0xbc, 0x5e, 0xd2, 0xe9,
|
||||
0x0f, 0x26, 0x78, 0xfd, 0xb8, 0xef, 0x2d, 0x5d, 0x47, 0x0b, 0x6a, 0xdf, 0xa1, 0x65, 0x01, 0xed,
|
||||
0x63, 0xe8, 0x4e, 0x98, 0xf1, 0x5b, 0x91, 0x9e, 0x57, 0xc5, 0xb4, 0xa8, 0x06, 0x7e, 0x0f, 0x62,
|
||||
0x6f, 0xaf, 0xc3, 0xdd, 0x27, 0x84, 0x1d, 0x08, 0x9b, 0xdd, 0x24, 0x3e, 0x09, 0x4e, 0x87, 0x99,
|
||||
0x34, 0x2a, 0x52, 0x7b, 0x6f, 0x96, 0x85, 0x82, 0x69, 0xca, 0x87, 0x38, 0xeb, 0xda, 0x1f, 0xe2,
|
||||
0x2a, 0x97, 0x7d, 0x88, 0xb3, 0x3f, 0x86, 0x1e, 0xdf, 0x59, 0x2a, 0x8a, 0x30, 0x20, 0x31, 0xcb,
|
||||
0x79, 0xe6, 0x3a, 0x34, 0x3c, 0x21, 0x71, 0x8d, 0x4f, 0x06, 0x20, 0x45, 0x9c, 0x5f, 0xd9, 0x8f,
|
||||
0x60, 0x6d, 0xca, 0x60, 0x15, 0xfc, 0x3b, 0xd0, 0x12, 0xb7, 0x58, 0x15, 0x39, 0xd1, 0x77, 0xbf,
|
||||
0x26, 0x97, 0xee, 0x68, 0xa1, 0xfd, 0x27, 0xbe, 0x4b, 0x08, 0xa6, 0x64, 0xc7, 0x8f, 0x82, 0xf8,
|
||||
0x38, 0x39, 0x23, 0xf9, 0xb5, 0xe5, 0x1d, 0x68, 0xa5, 0x19, 0x39, 0x0f, 0x92, 0x21, 0x75, 0x19,
|
||||
0x57, 0x88, 0x10, 0xaa, 0x4e, 0x53, 0x4b, 0x85, 0x35, 0x27, 0x50, 0xb9, 0x19, 0xbf, 0xe9, 0xbb,
|
||||
0x2c, 0x88, 0xe4, 0xb7, 0x84, 0xaa, 0xd3, 0xd1, 0x9a, 0x67, 0x89, 0x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, 0x80, 0x56, 0x99, 0xe3, 0xa3, 0x8d, 0xa9, 0x34,
|
||||
0xde, 0x68, 0x14, 0xfd, 0xfb, 0x97, 0x58, 0xe4, 0x8e, 0x7f, 0x0b, 0x9d, 0x71, 0xea, 0x8e, 0xec,
|
||||
0xa9, 0x03, 0x4b, 0xd7, 0x80, 0xfe, 0x5b, 0x97, 0xda, 0x98, 0x20, 0x14, 0xbd, 0xaa, 0x04, 0xc2,
|
||||
0x44, 0x63, 0x2b, 0x81, 0x30, 0xd9, 0xe0, 0x24, 0x08, 0xe5, 0x02, 0x5f, 0x02, 0x61, 0x6a, 0x3b,
|
||||
0x2a, 0x81, 0x30, 0xbd, 0x3b, 0xd8, 0x37, 0x50, 0x02, 0xab, 0xd3, 0xcb, 0x2e, 0x32, 0x3f, 0x1c,
|
||||
0x5e, 0x5a, 0xbb, 0xfb, 0x0f, 0xbe, 0x83, 0x65, 0x3e, 0xe1, 0x57, 0xd0, 0x9d, 0xa8, 0x92, 0xc8,
|
||||
0x84, 0x74, 0x56, 0x01, 0xee, 0xbf, 0x7d, 0xb9, 0x51, 0x3e, 0xc3, 0x97, 0xd0, 0x1e, 0x2b, 0x5b,
|
||||
0xa8, 0x04, 0xc5, 0xd4, 0x02, 0xd4, 0xb7, 0x2f, 0x33, 0x31, 0xa3, 0x9f, 0x28, 0x1a, 0xa5, 0xe8,
|
||||
0x67, 0x15, 0xb8, 0x52, 0xf4, 0x33, 0xeb, 0x8e, 0x7d, 0x63, 0xb0, 0x20, 0x7e, 0xf4, 0x7e, 0xf0,
|
||||
0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x11, 0x8c, 0x9d, 0xf8, 0x1d, 0x00, 0x00,
|
||||
}
|
||||
@@ -33,6 +33,7 @@ const (
|
||||
ErrBucketAlreadyExists
|
||||
ErrBucketAlreadyOwnedByYou
|
||||
ErrNoSuchBucket
|
||||
ErrNoSuchKey
|
||||
ErrNoSuchUpload
|
||||
ErrInvalidBucketName
|
||||
ErrInvalidDigest
|
||||
@@ -134,6 +135,11 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
||||
Description: "The specified bucket does not exist",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
},
|
||||
ErrNoSuchKey: {
|
||||
Code: "NoSuchKey",
|
||||
Description: "The specified key does not exist.",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
},
|
||||
ErrNoSuchUpload: {
|
||||
Code: "NoSuchUpload",
|
||||
Description: "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.",
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
@@ -76,13 +77,19 @@ func getRESTErrorResponse(err APIError, resource string) RESTErrorResponse {
|
||||
|
||||
func writeResponse(w http.ResponseWriter, statusCode int, response []byte, mType mimeType) {
|
||||
setCommonHeaders(w)
|
||||
if response != nil {
|
||||
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
|
||||
}
|
||||
if mType != mimeNone {
|
||||
w.Header().Set("Content-Type", string(mType))
|
||||
}
|
||||
w.WriteHeader(statusCode)
|
||||
if response != nil {
|
||||
glog.V(4).Infof("status %d %s: %s", statusCode, mType, string(response))
|
||||
w.Write(response)
|
||||
_, err := w.Write(response)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("write err: %v", err)
|
||||
}
|
||||
w.(http.Flusher).Flush()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/server"
|
||||
weed_server "github.com/chrislusf/seaweedfs/weed/server"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
@@ -108,8 +108,8 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque
|
||||
destUrl := fmt.Sprintf("http://%s%s/%s%s",
|
||||
s3a.option.Filer, s3a.option.BucketsPath, bucket, object)
|
||||
|
||||
s3a.proxyToFiler(w, r, destUrl, func(proxyResonse *http.Response, w http.ResponseWriter) {
|
||||
for k, v := range proxyResonse.Header {
|
||||
s3a.proxyToFiler(w, r, destUrl, func(proxyResponse *http.Response, w http.ResponseWriter) {
|
||||
for k, v := range proxyResponse.Header {
|
||||
w.Header()[k] = v
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
@@ -204,7 +204,7 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
|
||||
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, destUrl string, responseFn func(proxyResonse *http.Response, w http.ResponseWriter)) {
|
||||
func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, destUrl string, responseFn func(proxyResponse *http.Response, w http.ResponseWriter)) {
|
||||
|
||||
glog.V(2).Infof("s3 proxying %s to %s", r.Method, destUrl)
|
||||
|
||||
@@ -237,12 +237,12 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
|
||||
responseFn(resp, w)
|
||||
|
||||
}
|
||||
func passThroughResponse(proxyResonse *http.Response, w http.ResponseWriter) {
|
||||
for k, v := range proxyResonse.Header {
|
||||
func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) {
|
||||
for k, v := range proxyResponse.Header {
|
||||
w.Header()[k] = v
|
||||
}
|
||||
w.WriteHeader(proxyResonse.StatusCode)
|
||||
io.Copy(w, proxyResonse.Body)
|
||||
w.WriteHeader(proxyResponse.StatusCode)
|
||||
io.Copy(w, proxyResponse.Body)
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader io.Reader) (etag string, code ErrorCode) {
|
||||
|
||||
@@ -138,7 +138,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket, originalPrefix string, maxKeys
|
||||
} else {
|
||||
contents = append(contents, ListEntry{
|
||||
Key: fmt.Sprintf("%s%s", dir, entry.Name),
|
||||
LastModified: time.Unix(entry.Attributes.Mtime, 0),
|
||||
LastModified: time.Unix(entry.Attributes.Mtime, 0).UTC(),
|
||||
ETag: "\"" + filer2.ETag(entry) + "\"",
|
||||
Size: int64(filer2.TotalSize(entry.Chunks)),
|
||||
Owner: CanonicalUser{
|
||||
|
||||
@@ -62,7 +62,7 @@ func NewGuard(whiteList []string, signingKey string, expiresAfterSec int, readSi
|
||||
return g
|
||||
}
|
||||
|
||||
func (g *Guard) WhiteList(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
||||
func (g *Guard) WhiteList(f http.HandlerFunc) http.HandlerFunc {
|
||||
if !g.isWriteActive {
|
||||
//if no security needed, just skip all checking
|
||||
return f
|
||||
|
||||
@@ -46,6 +46,12 @@ func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj inter
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if httpStatus >= 400 {
|
||||
glog.V(0).Infof("response method:%s URL:%s with httpStatus:%d and JSON:%s",
|
||||
r.Method, r.URL.String(), httpStatus, string(bytes))
|
||||
}
|
||||
|
||||
callback := r.FormValue("callback")
|
||||
if callback == "" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
@@ -185,19 +191,19 @@ func parseURLPath(path string) (vid, fid, filename, ext string, isVolumeIdOnly b
|
||||
|
||||
func statsHealthHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
func statsCounterHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
m["Counters"] = serverStats
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
|
||||
func statsMemoryHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
m["Memory"] = stats.MemStat()
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ func (fs *FilerServer) AtomicRenameEntry(ctx context.Context, req *filer_pb.Atom
|
||||
moveErr := fs.moveEntry(ctx, oldParent, oldEntry, util.FullPath(filepath.ToSlash(req.NewDirectory)), req.NewName, &events)
|
||||
if moveErr != nil {
|
||||
fs.filer.RollbackTransaction(ctx)
|
||||
return nil, fmt.Errorf("%s/%s move error: %v", req.OldDirectory, req.OldName, err)
|
||||
return nil, fmt.Errorf("%s/%s move error: %v", req.OldDirectory, req.OldName, moveErr)
|
||||
} else {
|
||||
if commitError := fs.filer.CommitTransaction(ctx); commitError != nil {
|
||||
fs.filer.RollbackTransaction(ctx)
|
||||
return nil, fmt.Errorf("%s/%s move commit error: %v", req.OldDirectory, req.OldName, err)
|
||||
return nil, fmt.Errorf("%s/%s move commit error: %v", req.OldDirectory, req.OldName, commitError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
@@ -56,13 +57,66 @@ const (
|
||||
LockDuration = 10 * time.Second
|
||||
)
|
||||
|
||||
type AdminLock struct {
|
||||
accessSecret int64
|
||||
accessLockTime time.Time
|
||||
}
|
||||
|
||||
type AdminLocks struct {
|
||||
locks map[string]*AdminLock
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
func NewAdminLocks() *AdminLocks {
|
||||
return &AdminLocks{
|
||||
locks: make(map[string]*AdminLock),
|
||||
}
|
||||
}
|
||||
|
||||
func (locks *AdminLocks) isLocked(lockName string) bool {
|
||||
locks.RLock()
|
||||
defer locks.RUnlock()
|
||||
adminLock, found := locks.locks[lockName]
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
return adminLock.accessLockTime.Add(LockDuration).After(time.Now())
|
||||
}
|
||||
|
||||
func (locks *AdminLocks) isValidToken(lockName string, ts time.Time, token int64) bool {
|
||||
locks.RLock()
|
||||
defer locks.RUnlock()
|
||||
adminLock, found := locks.locks[lockName]
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
return adminLock.accessLockTime.Equal(ts) && adminLock.accessSecret == token
|
||||
}
|
||||
|
||||
func (locks *AdminLocks) generateToken(lockName string) (ts time.Time, token int64) {
|
||||
locks.Lock()
|
||||
defer locks.Unlock()
|
||||
lock := &AdminLock{
|
||||
accessSecret: rand.Int63(),
|
||||
accessLockTime: time.Now(),
|
||||
}
|
||||
locks.locks[lockName] = lock
|
||||
return lock.accessLockTime, lock.accessSecret
|
||||
}
|
||||
|
||||
func (locks *AdminLocks) deleteLock(lockName string) {
|
||||
locks.Lock()
|
||||
defer locks.Unlock()
|
||||
delete(locks.locks, lockName)
|
||||
}
|
||||
|
||||
func (ms *MasterServer) LeaseAdminToken(ctx context.Context, req *master_pb.LeaseAdminTokenRequest) (*master_pb.LeaseAdminTokenResponse, error) {
|
||||
resp := &master_pb.LeaseAdminTokenResponse{}
|
||||
|
||||
if ms.adminAccessSecret != 0 && ms.adminAccessLockTime.Add(LockDuration).After(time.Now()) {
|
||||
if req.PreviousToken != 0 && ms.isValidToken(time.Unix(0, req.PreviousLockTime), req.PreviousToken) {
|
||||
if ms.adminLocks.isLocked(req.LockName) {
|
||||
if req.PreviousToken != 0 && ms.adminLocks.isValidToken(req.LockName, time.Unix(0, req.PreviousLockTime), req.PreviousToken) {
|
||||
// for renew
|
||||
ts, token := ms.generateToken()
|
||||
ts, token := ms.adminLocks.generateToken(req.LockName)
|
||||
resp.Token, resp.LockTsNs = token, ts.UnixNano()
|
||||
return resp, nil
|
||||
}
|
||||
@@ -70,24 +124,15 @@ func (ms *MasterServer) LeaseAdminToken(ctx context.Context, req *master_pb.Leas
|
||||
return resp, fmt.Errorf("already locked")
|
||||
}
|
||||
// for fresh lease request
|
||||
ts, token := ms.generateToken()
|
||||
ts, token := ms.adminLocks.generateToken(req.LockName)
|
||||
resp.Token, resp.LockTsNs = token, ts.UnixNano()
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (ms *MasterServer) isValidToken(ts time.Time, token int64) bool {
|
||||
return ms.adminAccessLockTime.Equal(ts) && ms.adminAccessSecret == token
|
||||
}
|
||||
func (ms *MasterServer) generateToken() (ts time.Time, token int64) {
|
||||
ms.adminAccessLockTime = time.Now()
|
||||
ms.adminAccessSecret = rand.Int63()
|
||||
return ms.adminAccessLockTime, ms.adminAccessSecret
|
||||
}
|
||||
|
||||
func (ms *MasterServer) ReleaseAdminToken(ctx context.Context, req *master_pb.ReleaseAdminTokenRequest) (*master_pb.ReleaseAdminTokenResponse, error) {
|
||||
resp := &master_pb.ReleaseAdminTokenResponse{}
|
||||
if ms.isValidToken(time.Unix(0, req.PreviousLockTime), req.PreviousToken) {
|
||||
ms.adminAccessSecret = 0
|
||||
if ms.adminLocks.isValidToken(req.LockName, time.Unix(0, req.PreviousLockTime), req.PreviousToken) {
|
||||
ms.adminLocks.deleteLock(req.LockName)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
@@ -37,7 +37,7 @@ type MasterOption struct {
|
||||
MetaFolder string
|
||||
VolumeSizeLimitMB uint
|
||||
VolumePreallocate bool
|
||||
PulseSeconds int
|
||||
// PulseSeconds int
|
||||
DefaultReplicaPlacement string
|
||||
GarbageThreshold float64
|
||||
WhiteList []string
|
||||
@@ -66,8 +66,7 @@ type MasterServer struct {
|
||||
|
||||
MasterClient *wdclient.MasterClient
|
||||
|
||||
adminAccessSecret int64
|
||||
adminAccessLockTime time.Time
|
||||
adminLocks *AdminLocks
|
||||
}
|
||||
|
||||
func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *MasterServer {
|
||||
@@ -96,6 +95,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
|
||||
clientChans: make(map[string]chan *master_pb.VolumeLocation),
|
||||
grpcDialOption: grpcDialOption,
|
||||
MasterClient: wdclient.NewMasterClient(grpcDialOption, "master", option.Host, 0, peers),
|
||||
adminLocks: NewAdminLocks(),
|
||||
}
|
||||
ms.bounedLeaderChan = make(chan int, 16)
|
||||
|
||||
@@ -103,7 +103,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
|
||||
if nil == seq {
|
||||
glog.Fatalf("create sequencer failed.")
|
||||
}
|
||||
ms.Topo = topology.NewTopology("topo", seq, uint64(ms.option.VolumeSizeLimitMB)*1024*1024, ms.option.PulseSeconds, replicationAsMin)
|
||||
ms.Topo = topology.NewTopology("topo", seq, uint64(ms.option.VolumeSizeLimitMB)*1024*1024, 5, replicationAsMin)
|
||||
ms.vg = topology.NewDefaultVolumeGrowth()
|
||||
glog.V(0).Infoln("Volume Size Limit is", ms.option.VolumeSizeLimitMB, "MB")
|
||||
|
||||
@@ -156,7 +156,7 @@ func (ms *MasterServer) SetRaftServer(raftServer *RaftServer) {
|
||||
}
|
||||
}
|
||||
|
||||
func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
||||
func (ms *MasterServer) proxyToLeader(f http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if ms.Topo.IsLeader() {
|
||||
f(w, r)
|
||||
|
||||
@@ -44,7 +44,7 @@ func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.R
|
||||
|
||||
func (ms *MasterServer) dirStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
m["Topology"] = ms.Topo.ToMap()
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
@@ -93,7 +93,7 @@ func (ms *MasterServer) volumeGrowHandler(w http.ResponseWriter, r *http.Request
|
||||
|
||||
func (ms *MasterServer) volumeStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
m["Volumes"] = ms.Topo.ToVolumeMap()
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request)
|
||||
Stats map[string]interface{}
|
||||
Counters *stats.ServerStats
|
||||
}{
|
||||
util.VERSION,
|
||||
util.Version(),
|
||||
ms.Topo.ToMap(),
|
||||
ms.Topo.RaftServer,
|
||||
infos,
|
||||
|
||||
@@ -76,6 +76,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
||||
<th>Rack</th>
|
||||
<th>RemoteAddr</th>
|
||||
<th>#Volumes</th>
|
||||
<th>Volume Ids</th>
|
||||
<th>#ErasureCodingShards</th>
|
||||
<th>Max</th>
|
||||
</tr>
|
||||
@@ -89,6 +90,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
||||
<td>{{ $rack.Id }}</td>
|
||||
<td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a></td>
|
||||
<td>{{ $dn.Volumes }}</td>
|
||||
<td>{{ $dn.VolumeIds}}</td>
|
||||
<td>{{ $dn.EcShards }}</td>
|
||||
<td>{{ $dn.Max }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -201,9 +201,7 @@ func (vs *VolumeServer) VolumeEcShardsDelete(ctx context.Context, req *volume_se
|
||||
if err := os.Remove(baseFilename + ".ecx"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.Remove(baseFilename + ".ecj"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
os.Remove(baseFilename + ".ecj")
|
||||
}
|
||||
if !hasIdxFile {
|
||||
// .vif is used for ec volumes and normal volumes
|
||||
|
||||
@@ -35,7 +35,7 @@ type VolumeServer struct {
|
||||
|
||||
func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
port int, publicUrl string,
|
||||
folders []string, maxCounts []int,
|
||||
folders []string, maxCounts []int, minFreeSpacePercent []float32,
|
||||
needleMapKind storage.NeedleMapType,
|
||||
masterNodes []string, pulseSeconds int,
|
||||
dataCenter string, rack string,
|
||||
@@ -68,8 +68,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,
|
||||
}
|
||||
vs.SeedMasterNodes = masterNodes
|
||||
vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, vs.needleMapKind)
|
||||
|
||||
vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercent, vs.needleMapKind)
|
||||
vs.guard = security.NewGuard(whiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec)
|
||||
|
||||
handleStaticResources(adminMux)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
var ds []*volume_server_pb.DiskStatus
|
||||
for _, loc := range vs.store.Locations {
|
||||
if dir, e := filepath.Abs(loc.Directory); e == nil {
|
||||
@@ -25,7 +25,7 @@ func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Version"] = util.Version()
|
||||
var ds []*volume_server_pb.DiskStatus
|
||||
for _, loc := range vs.store.Locations {
|
||||
if dir, e := filepath.Abs(loc.Directory); e == nil {
|
||||
|
||||
@@ -40,7 +40,7 @@ func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request)
|
||||
Stats interface{}
|
||||
Counters *stats.ServerStats
|
||||
}{
|
||||
util.VERSION,
|
||||
util.Version(),
|
||||
vs.SeedMasterNodes,
|
||||
normalVolumeInfos,
|
||||
vs.store.EcVolumes(),
|
||||
|
||||
@@ -42,18 +42,18 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
needle, originalSize, ne := needle.CreateNeedleFromRequest(r, vs.FixJpgOrientation, vs.fileSizeLimitBytes)
|
||||
reqNeedle, originalSize, ne := needle.CreateNeedleFromRequest(r, vs.FixJpgOrientation, vs.fileSizeLimitBytes)
|
||||
if ne != nil {
|
||||
writeJsonError(w, r, http.StatusBadRequest, ne)
|
||||
return
|
||||
}
|
||||
|
||||
ret := operation.UploadResult{}
|
||||
isUnchanged, writeError := topology.ReplicatedWrite(vs.GetMaster(), vs.store, volumeId, needle, r)
|
||||
isUnchanged, writeError := topology.ReplicatedWrite(vs.GetMaster(), vs.store, volumeId, reqNeedle, r)
|
||||
|
||||
// http 204 status code does not allow body
|
||||
if writeError == nil && isUnchanged {
|
||||
setEtag(w, needle.Etag())
|
||||
setEtag(w, reqNeedle.Etag())
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
@@ -63,12 +63,12 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
httpStatus = http.StatusInternalServerError
|
||||
ret.Error = writeError.Error()
|
||||
}
|
||||
if needle.HasName() {
|
||||
ret.Name = string(needle.Name)
|
||||
if reqNeedle.HasName() {
|
||||
ret.Name = string(reqNeedle.Name)
|
||||
}
|
||||
ret.Size = uint32(originalSize)
|
||||
ret.ETag = needle.Etag()
|
||||
ret.Mime = string(needle.Mime)
|
||||
ret.ETag = reqNeedle.Etag()
|
||||
ret.Mime = string(reqNeedle.Mime)
|
||||
setEtag(w, ret.ETag)
|
||||
writeJsonQuiet(w, r, httpStatus, ret)
|
||||
}
|
||||
|
||||
@@ -2,24 +2,12 @@ package master_ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"html/template"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func bytesToHumanReadble(b uint64) string {
|
||||
const unit = 1024
|
||||
if b < unit {
|
||||
return fmt.Sprintf("%d B", b)
|
||||
}
|
||||
div, exp := uint64(unit), 0
|
||||
for n := b / unit; n >= unit; n /= unit {
|
||||
div *= unit
|
||||
exp++
|
||||
}
|
||||
return fmt.Sprintf("%.2f %ciB", float64(b)/float64(div), "KMGTPE"[exp])
|
||||
}
|
||||
|
||||
func percentFrom(total uint64, part_of uint64) string {
|
||||
return fmt.Sprintf("%.2f", (float64(part_of)/float64(total))*100)
|
||||
}
|
||||
@@ -33,9 +21,9 @@ func join(data []int64) string {
|
||||
}
|
||||
|
||||
var funcMap = template.FuncMap{
|
||||
"join": join,
|
||||
"bytesToHumanReadble": bytesToHumanReadble,
|
||||
"percentFrom": percentFrom,
|
||||
"join": join,
|
||||
"bytesToHumanReadable": util.BytesToHumanReadable,
|
||||
"percentFrom": percentFrom,
|
||||
}
|
||||
|
||||
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOCTYPE html>
|
||||
@@ -90,8 +78,8 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
|
||||
{{ range .DiskStatuses }}
|
||||
<tr>
|
||||
<td>{{ .Dir }}</td>
|
||||
<td>{{ bytesToHumanReadble .All }}</td>
|
||||
<td>{{ bytesToHumanReadble .Free }}</td>
|
||||
<td>{{ bytesToHumanReadable .All }}</td>
|
||||
<td>{{ bytesToHumanReadable .Free }}</td>
|
||||
<td>{{ percentFrom .All .Used}}%</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
@@ -151,9 +139,9 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
|
||||
<tr>
|
||||
<td><code>{{ .Id }}</code></td>
|
||||
<td>{{ .Collection }}</td>
|
||||
<td>{{ bytesToHumanReadble .Size }}</td>
|
||||
<td>{{ bytesToHumanReadable .Size }}</td>
|
||||
<td>{{ .FileCount }}</td>
|
||||
<td>{{ .DeleteCount }} / {{bytesToHumanReadble .DeletedByteCount}}</td>
|
||||
<td>{{ .DeleteCount }} / {{bytesToHumanReadable .DeletedByteCount}}</td>
|
||||
<td>{{ .Ttl }}</td>
|
||||
<td>{{ .ReadOnly }}</td>
|
||||
</tr>
|
||||
@@ -181,9 +169,9 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
|
||||
<tr>
|
||||
<td><code>{{ .Id }}</code></td>
|
||||
<td>{{ .Collection }}</td>
|
||||
<td>{{ bytesToHumanReadble .Size }}</td>
|
||||
<td>{{ bytesToHumanReadable .Size }}</td>
|
||||
<td>{{ .FileCount }}</td>
|
||||
<td>{{ .DeleteCount }} / {{bytesToHumanReadble .DeletedByteCount}}</td>
|
||||
<td>{{ .DeleteCount }} / {{bytesToHumanReadable .DeletedByteCount}}</td>
|
||||
<td>{{ .RemoteStorageName }}</td>
|
||||
<td>{{ .RemoteStorageKey }}</td>
|
||||
</tr>
|
||||
@@ -209,7 +197,7 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
|
||||
<tr>
|
||||
<td><code>{{ .VolumeId }}</code></td>
|
||||
<td>{{ .Collection }}</td>
|
||||
<td>{{ bytesToHumanReadble .ShardSize }}</td>
|
||||
<td>{{ bytesToHumanReadable .ShardSize }}</td>
|
||||
<td>{{ .ShardIdList }}</td>
|
||||
<td>{{ .CreatedAt.Format "02 Jan 06 15:04 -0700" }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -487,6 +487,10 @@ func (f *WebDavFile) Read(p []byte) (readSize int, err error) {
|
||||
glog.V(3).Infof("WebDavFileSystem.Read %v: [%d,%d)", f.name, f.off, f.off+int64(readSize))
|
||||
f.off += int64(readSize)
|
||||
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("file read %s: %v", f.name, err)
|
||||
}
|
||||
|
||||
@@ -123,6 +123,8 @@ func markVolumeReadonly(grpcDialOption grpc.DialOption, volumeId needle.VolumeId
|
||||
|
||||
for _, location := range locations {
|
||||
|
||||
fmt.Printf("markVolumeReadonly %d on %s ...\n", volumeId, location.Url)
|
||||
|
||||
err := operation.WithVolumeServerClient(location.Url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
_, markErr := volumeServerClient.VolumeMarkReadonly(context.Background(), &volume_server_pb.VolumeMarkReadonlyRequest{
|
||||
VolumeId: uint32(volumeId),
|
||||
@@ -141,6 +143,8 @@ func markVolumeReadonly(grpcDialOption grpc.DialOption, volumeId needle.VolumeId
|
||||
|
||||
func generateEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, collection string, sourceVolumeServer string) error {
|
||||
|
||||
fmt.Printf("generateEcShards %s %d on %s ...\n", collection, volumeId, sourceVolumeServer)
|
||||
|
||||
err := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
_, genErr := volumeServerClient.VolumeEcShardsGenerate(context.Background(), &volume_server_pb.VolumeEcShardsGenerateRequest{
|
||||
VolumeId: uint32(volumeId),
|
||||
@@ -204,6 +208,8 @@ func spreadEcShards(commandEnv *CommandEnv, volumeId needle.VolumeId, collection
|
||||
|
||||
func parallelCopyEcShardsFromSource(grpcDialOption grpc.DialOption, targetServers []*EcNode, allocatedEcIds [][]uint32, volumeId needle.VolumeId, collection string, existingLocation wdclient.Location) (actuallyCopied []uint32, err error) {
|
||||
|
||||
fmt.Printf("parallelCopyEcShardsFromSource %d %s\n", volumeId, existingLocation.Url)
|
||||
|
||||
// parallelize
|
||||
shardIdChan := make(chan []uint32, len(targetServers))
|
||||
var wg sync.WaitGroup
|
||||
|
||||
@@ -121,7 +121,10 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
|
||||
VolumeId: volumeInfo.Id,
|
||||
SourceDataNode: sourceNode.dataNode.Id,
|
||||
})
|
||||
return fmt.Errorf("copying from %s => %s : %v", sourceNode.dataNode.Id, dst.dataNode.Id, replicateErr)
|
||||
if replicateErr != nil {
|
||||
return fmt.Errorf("copying from %s => %s : %v", sourceNode.dataNode.Id, dst.dataNode.Id, replicateErr)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient/exclusive_locks"
|
||||
)
|
||||
|
||||
type ShellOptions struct {
|
||||
@@ -28,7 +29,7 @@ type CommandEnv struct {
|
||||
env map[string]string
|
||||
MasterClient *wdclient.MasterClient
|
||||
option ShellOptions
|
||||
locker *ExclusiveLocker
|
||||
locker *exclusive_locks.ExclusiveLocker
|
||||
}
|
||||
|
||||
type command interface {
|
||||
@@ -47,7 +48,7 @@ func NewCommandEnv(options ShellOptions) *CommandEnv {
|
||||
MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, pb.AdminShellClient, "", 0, strings.Split(*options.Masters, ",")),
|
||||
option: options,
|
||||
}
|
||||
ce.locker = NewExclusiveLocker(ce.MasterClient)
|
||||
ce.locker = exclusive_locks.NewExclusiveLocker(ce.MasterClient)
|
||||
return ce
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ func (ce *CommandEnv) isDirectory(path string) bool {
|
||||
|
||||
func (ce *CommandEnv) confirmIsLocked() error {
|
||||
|
||||
if ce.locker.isLocking {
|
||||
if ce.locker.IsLocking() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build windows openbsd netbsd plan9 solaris
|
||||
// +build openbsd netbsd plan9 solaris
|
||||
|
||||
package stats
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
kernel32 = windows.NewLazySystemDLL("Kernel32.dll")
|
||||
getDiskFreeSpaceEx = kernel32.NewProc("GetDiskFreeSpaceExW")
|
||||
)
|
||||
|
||||
func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
|
||||
|
||||
ptr, err := syscall.UTF16PtrFromString(disk.Dir)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _temp uint64
|
||||
/* #nosec */
|
||||
r, _, e := syscall.Syscall6(
|
||||
getDiskFreeSpaceEx.Addr(),
|
||||
4,
|
||||
uintptr(unsafe.Pointer(ptr)),
|
||||
uintptr(unsafe.Pointer(&disk.Free)),
|
||||
uintptr(unsafe.Pointer(&disk.All)),
|
||||
uintptr(unsafe.Pointer(&_temp)),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
|
||||
if r == 0 {
|
||||
if e != 0 {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
disk.Used = disk.All - disk.Free
|
||||
disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100)
|
||||
disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -2,10 +2,13 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/erasure_coding"
|
||||
@@ -13,20 +16,22 @@ import (
|
||||
)
|
||||
|
||||
type DiskLocation struct {
|
||||
Directory string
|
||||
MaxVolumeCount int
|
||||
volumes map[needle.VolumeId]*Volume
|
||||
volumesLock sync.RWMutex
|
||||
Directory string
|
||||
MaxVolumeCount int
|
||||
MinFreeSpacePercent float32
|
||||
volumes map[needle.VolumeId]*Volume
|
||||
volumesLock sync.RWMutex
|
||||
|
||||
// erasure coding
|
||||
ecVolumes map[needle.VolumeId]*erasure_coding.EcVolume
|
||||
ecVolumesLock sync.RWMutex
|
||||
}
|
||||
|
||||
func NewDiskLocation(dir string, maxVolumeCount int) *DiskLocation {
|
||||
location := &DiskLocation{Directory: dir, MaxVolumeCount: maxVolumeCount}
|
||||
func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32) *DiskLocation {
|
||||
location := &DiskLocation{Directory: dir, MaxVolumeCount: maxVolumeCount, MinFreeSpacePercent: minFreeSpacePercent}
|
||||
location.volumes = make(map[needle.VolumeId]*Volume)
|
||||
location.ecVolumes = make(map[needle.VolumeId]*erasure_coding.EcVolume)
|
||||
go location.CheckDiskSpace()
|
||||
return location
|
||||
}
|
||||
|
||||
@@ -293,3 +298,21 @@ func (l *DiskLocation) UnUsedSpace(volumeSizeLimit uint64) (unUsedSpace uint64)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (l *DiskLocation) CheckDiskSpace() {
|
||||
lastStat := false
|
||||
t := time.NewTicker(time.Minute)
|
||||
for _ = range t.C {
|
||||
if dir, e := filepath.Abs(l.Directory); e == nil {
|
||||
s := stats.NewDiskStatus(dir)
|
||||
if (s.PercentFree < l.MinFreeSpacePercent) != lastStat {
|
||||
lastStat = !lastStat
|
||||
for _, v := range l.volumes {
|
||||
v.SetLowDiskSpace(lastStat)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle_map"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/super_block"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
// write .idx file from .ecx and .ecj files
|
||||
@@ -118,9 +119,12 @@ func iterateEcxFile(baseFileName string, processNeedleFn func(key types.NeedleId
|
||||
}
|
||||
|
||||
func iterateEcjFile(baseFileName string, processNeedleFn func(key types.NeedleId) error) error {
|
||||
if !util.FileExists(baseFileName+".ecj") {
|
||||
return nil
|
||||
}
|
||||
ecjFile, openErr := os.OpenFile(baseFileName+".ecj", os.O_RDONLY, 0644)
|
||||
if openErr != nil {
|
||||
return fmt.Errorf("cannot open ec index %s.ecx: %v", baseFileName, openErr)
|
||||
return fmt.Errorf("cannot open ec index %s.ecj: %v", baseFileName, openErr)
|
||||
}
|
||||
defer ecjFile.Close()
|
||||
|
||||
|
||||
@@ -140,6 +140,10 @@ func (n *Needle) Append(w backend.BackendStorageFile, version Version) (offset u
|
||||
err = fmt.Errorf("Cannot Read Current Volume Position: %v", e)
|
||||
return
|
||||
}
|
||||
if offset >= MaxPossibleVolumeSize {
|
||||
err = fmt.Errorf("Volume Size %d Exeededs %d", offset, MaxPossibleVolumeSize)
|
||||
return
|
||||
}
|
||||
|
||||
bytesToWrite, size, actualSize, err := n.prepareWriteBuffer(version)
|
||||
|
||||
|
||||
@@ -5,14 +5,17 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/idx"
|
||||
"github.com/syndtr/goleveldb/leveldb/errors"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/idx"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle_map"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
)
|
||||
|
||||
type LevelDbNeedleMap struct {
|
||||
@@ -32,7 +35,12 @@ func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File, opts *opt.Option
|
||||
glog.V(1).Infof("Opening %s...", dbFileName)
|
||||
|
||||
if m.db, err = leveldb.OpenFile(dbFileName, opts); err != nil {
|
||||
return
|
||||
if errors.IsCorrupted(err) {
|
||||
m.db, err = leveldb.RecoverFile(dbFileName, opts)
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
glog.V(1).Infof("Loading %s...", indexFile.Name())
|
||||
mm, indexLoadError := newNeedleMapMetricFromIndexFile(indexFile)
|
||||
|
||||
@@ -48,11 +48,11 @@ func (s *Store) String() (str string) {
|
||||
return
|
||||
}
|
||||
|
||||
func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, needleMapKind NeedleMapType) (s *Store) {
|
||||
func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, freeDiskSpaceWatermark []float32, needleMapKind NeedleMapType) (s *Store) {
|
||||
s = &Store{grpcDialOption: grpcDialOption, Port: port, Ip: ip, PublicUrl: publicUrl, NeedleMapType: needleMapKind}
|
||||
s.Locations = make([]*DiskLocation, 0)
|
||||
for i := 0; i < len(dirnames); i++ {
|
||||
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i])
|
||||
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], freeDiskSpaceWatermark[i])
|
||||
location.loadExistingVolumes(needleMapKind)
|
||||
s.Locations = append(s.Locations, location)
|
||||
stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))
|
||||
|
||||
@@ -11,7 +11,7 @@ type OffsetHigher struct {
|
||||
}
|
||||
|
||||
const (
|
||||
OffsetSize = 4
|
||||
OffsetSize = 4
|
||||
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 // 32GB
|
||||
)
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ type OffsetHigher struct {
|
||||
}
|
||||
|
||||
const (
|
||||
OffsetSize = 4 + 1
|
||||
MaxPossibleVolumeSize = 4 * 1024 * 1024 * 1024 * 8 * 256 /* 256 is from the extra byte */ // 8TB
|
||||
OffsetSize = 4 + 1
|
||||
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 * 256 /* 256 is from the extra byte */ // 8TB
|
||||
)
|
||||
|
||||
func OffsetToBytes(bytes []byte, offset Offset) {
|
||||
|
||||
@@ -27,6 +27,7 @@ type Volume struct {
|
||||
needleMapKind NeedleMapType
|
||||
noWriteOrDelete bool // if readonly, either noWriteOrDelete or noWriteCanDelete
|
||||
noWriteCanDelete bool // if readonly, either noWriteOrDelete or noWriteCanDelete
|
||||
lowDiskSpace bool
|
||||
hasRemoteFile bool // if the volume has a remote file
|
||||
MemoryMapMaxSizeMb uint32
|
||||
|
||||
@@ -45,6 +46,11 @@ type Volume struct {
|
||||
volumeInfo *volume_server_pb.VolumeInfo
|
||||
}
|
||||
|
||||
func (v *Volume) SetLowDiskSpace(lowDiskSpace bool) {
|
||||
glog.V(0).Infof("SetLowDiskSpace id %d value %t", v.Id, lowDiskSpace)
|
||||
v.lowDiskSpace = lowDiskSpace
|
||||
}
|
||||
|
||||
func NewVolume(dirname string, collection string, id needle.VolumeId, needleMapKind NeedleMapType, replicaPlacement *super_block.ReplicaPlacement, ttl *needle.TTL, preallocate int64, memoryMapMaxSizeMb uint32) (v *Volume, e error) {
|
||||
// if replicaPlacement is nil, the superblock will be loaded from disk
|
||||
v = &Volume{dir: dirname, Collection: collection, Id: id, MemoryMapMaxSizeMb: memoryMapMaxSizeMb,
|
||||
@@ -244,5 +250,5 @@ func (v *Volume) RemoteStorageNameKey() (storageName, storageKey string) {
|
||||
}
|
||||
|
||||
func (v *Volume) IsReadOnly() bool {
|
||||
return v.noWriteOrDelete || v.noWriteCanDelete
|
||||
return v.noWriteOrDelete || v.noWriteCanDelete || v.lowDiskSpace
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func (v *Volume) syncWrite(n *needle.Needle) (offset uint64, size uint32, isUnch
|
||||
defer v.dataFileAccessLock.Unlock()
|
||||
|
||||
if MaxPossibleVolumeSize < v.nm.ContentSize()+uint64(actualSize) {
|
||||
err = fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.ContentSize())
|
||||
err = fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.nm.ContentSize())
|
||||
return
|
||||
}
|
||||
if v.isFileUnchanged(n) {
|
||||
@@ -190,7 +190,7 @@ func (v *Volume) syncDelete(n *needle.Needle) (uint32, error) {
|
||||
defer v.dataFileAccessLock.Unlock()
|
||||
|
||||
if MaxPossibleVolumeSize < v.nm.ContentSize()+uint64(actualSize) {
|
||||
err := fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.ContentSize())
|
||||
err := fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.nm.ContentSize())
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package topology
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
@@ -40,7 +41,7 @@ func (dn *DataNode) String() string {
|
||||
return fmt.Sprintf("Node:%s, volumes:%v, Ip:%s, Port:%d, PublicUrl:%s", dn.NodeImpl.String(), dn.volumes, dn.Ip, dn.Port, dn.PublicUrl)
|
||||
}
|
||||
|
||||
func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) (isNew bool) {
|
||||
func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO bool) {
|
||||
dn.Lock()
|
||||
defer dn.Unlock()
|
||||
if oldV, ok := dn.volumes[v.Id]; !ok {
|
||||
@@ -63,12 +64,13 @@ func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) (isNew bool) {
|
||||
dn.UpAdjustRemoteVolumeCountDelta(-1)
|
||||
}
|
||||
}
|
||||
isChangedRO = dn.volumes[v.Id].ReadOnly != v.ReadOnly
|
||||
dn.volumes[v.Id] = v
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolumes, deletedVolumes []storage.VolumeInfo) {
|
||||
func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolumes, deletedVolumes, changeRO []storage.VolumeInfo) {
|
||||
actualVolumeMap := make(map[needle.VolumeId]storage.VolumeInfo)
|
||||
for _, v := range actualVolumes {
|
||||
actualVolumeMap[v.Id] = v
|
||||
@@ -90,10 +92,13 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolume
|
||||
}
|
||||
dn.Unlock()
|
||||
for _, v := range actualVolumes {
|
||||
isNew := dn.AddOrUpdateVolume(v)
|
||||
isNew, isChangedRO := dn.AddOrUpdateVolume(v)
|
||||
if isNew {
|
||||
newVolumes = append(newVolumes, v)
|
||||
}
|
||||
if isChangedRO {
|
||||
changeRO = append(changeRO, v)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -166,6 +171,7 @@ func (dn *DataNode) ToMap() interface{} {
|
||||
ret := make(map[string]interface{})
|
||||
ret["Url"] = dn.Url()
|
||||
ret["Volumes"] = dn.GetVolumeCount()
|
||||
ret["VolumeIds"] = dn.GetVolumeIds()
|
||||
ret["EcShards"] = dn.GetEcShardCount()
|
||||
ret["Max"] = dn.GetMaxVolumeCount()
|
||||
ret["Free"] = dn.FreeSpace()
|
||||
@@ -190,3 +196,14 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// GetVolumeIds returns the human readable volume ids limited to count of max 100.
|
||||
func (dn *DataNode) GetVolumeIds() string {
|
||||
ids := make([]int, 0, len(dn.volumes))
|
||||
|
||||
for k := range dn.volumes {
|
||||
ids = append(ids, int(k))
|
||||
}
|
||||
|
||||
return util.HumanReadableIntsMax(100, ids...)
|
||||
}
|
||||
@@ -212,13 +212,18 @@ func (t *Topology) SyncDataNodeRegistration(volumes []*master_pb.VolumeInformati
|
||||
}
|
||||
}
|
||||
// find out the delta volumes
|
||||
newVolumes, deletedVolumes = dn.UpdateVolumes(volumeInfos)
|
||||
var changedVolumes []storage.VolumeInfo
|
||||
newVolumes, deletedVolumes, changedVolumes = dn.UpdateVolumes(volumeInfos)
|
||||
for _, v := range newVolumes {
|
||||
t.RegisterVolumeLayout(v, dn)
|
||||
}
|
||||
for _, v := range deletedVolumes {
|
||||
t.UnRegisterVolumeLayout(v, dn)
|
||||
}
|
||||
for _, v := range changedVolumes {
|
||||
vl := t.GetVolumeLayout(v.Collection, v.ReplicaPlacement, v.Ttl)
|
||||
vl.ensureCorrectWritables(&v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package bounded_tree
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
Parent *Node
|
||||
Name string
|
||||
Children map[string]*Node
|
||||
}
|
||||
|
||||
type BoundedTree struct {
|
||||
root *Node
|
||||
}
|
||||
|
||||
func NewBoundedTree() *BoundedTree {
|
||||
return &BoundedTree{
|
||||
root: &Node{
|
||||
Name: "/",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type VisitNodeFunc func(path util.FullPath) (childDirectories []string, err error)
|
||||
|
||||
// If the path is not visited, call the visitFn for each level of directory
|
||||
// No action if the directory has been visited before or does not exist.
|
||||
// A leaf node, which has no children, represents a directory not visited.
|
||||
// A non-leaf node or a non-existing node represents a directory already visited, or does not need to visit.
|
||||
func (t *BoundedTree) EnsureVisited(p util.FullPath, visitFn VisitNodeFunc) {
|
||||
// println()
|
||||
// println("EnsureVisited", p)
|
||||
|
||||
if t.root == nil {
|
||||
return
|
||||
}
|
||||
components := p.Split()
|
||||
// fmt.Printf("components %v %d\n", components, len(components))
|
||||
if canDelete := t.ensureVisited(t.root, util.FullPath("/"), components, 0, visitFn); canDelete {
|
||||
t.root = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (t *BoundedTree) ensureVisited(n *Node, currentPath util.FullPath, components []string, i int, visitFn VisitNodeFunc) (canDeleteNode bool) {
|
||||
|
||||
// println("ensureVisited", currentPath, i)
|
||||
|
||||
if n == nil {
|
||||
// fmt.Printf("%s null\n", currentPath)
|
||||
return
|
||||
}
|
||||
|
||||
if n.isVisited() {
|
||||
// fmt.Printf("%s visited %v\n", currentPath, n.Name)
|
||||
} else {
|
||||
// fmt.Printf("ensure %v\n", currentPath)
|
||||
|
||||
children, err := visitFn(currentPath)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("failed to visit %s: %v", currentPath, err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(children) == 0 {
|
||||
// fmt.Printf(" canDelete %v without children\n", currentPath)
|
||||
return true
|
||||
}
|
||||
|
||||
n.Children = make(map[string]*Node)
|
||||
for _, child := range children {
|
||||
// fmt.Printf(" add child %v %v\n", currentPath, child)
|
||||
n.Children[child] = &Node{
|
||||
Name: child,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if i >= len(components) {
|
||||
return
|
||||
}
|
||||
|
||||
// fmt.Printf(" check child %v %v\n", currentPath, components[i])
|
||||
|
||||
toVisitNode, found := n.Children[components[i]]
|
||||
if !found {
|
||||
// fmt.Printf(" did not find child %v %v\n", currentPath, components[i])
|
||||
return
|
||||
}
|
||||
|
||||
// fmt.Printf(" ensureVisited %v %v\n", currentPath, toVisitNode.Name)
|
||||
|
||||
if canDelete := t.ensureVisited(toVisitNode, currentPath.Child(components[i]), components, i+1, visitFn); canDelete {
|
||||
|
||||
// fmt.Printf(" delete %v %v\n", currentPath, components[i])
|
||||
delete(n.Children, components[i])
|
||||
|
||||
if len(n.Children) == 0 {
|
||||
// fmt.Printf(" canDelete %v\n", currentPath)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
func (n *Node) isVisited() bool {
|
||||
if n == nil {
|
||||
return true
|
||||
}
|
||||
if len(n.Children) > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (n *Node) getChild(childName string) *Node {
|
||||
if n == nil {
|
||||
return nil
|
||||
}
|
||||
if len(n.Children) > 0 {
|
||||
return n.Children[childName]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *BoundedTree) HasVisited(p util.FullPath) bool {
|
||||
|
||||
if t.root == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
components := p.Split()
|
||||
// fmt.Printf("components %v %d\n", components, len(components))
|
||||
return t.hasVisited(t.root, util.FullPath("/"), components, 0)
|
||||
}
|
||||
|
||||
func (t *BoundedTree) hasVisited(n *Node, currentPath util.FullPath, components []string, i int) bool {
|
||||
|
||||
if n == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if !n.isVisited() {
|
||||
return false
|
||||
}
|
||||
|
||||
// fmt.Printf(" hasVisited child %v %+v %d\n", currentPath, components, i)
|
||||
|
||||
if i >= len(components) {
|
||||
return true
|
||||
}
|
||||
|
||||
toVisitNode, found := n.Children[components[i]]
|
||||
if !found {
|
||||
return true
|
||||
}
|
||||
|
||||
return t.hasVisited(toVisitNode, currentPath.Child(components[i]), components, i+1)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package bounded_tree
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
|
||||
var (
|
||||
|
||||
visitFn = func(path util.FullPath) (childDirectories []string, err error) {
|
||||
fmt.Printf(" visit %v ...\n", path)
|
||||
switch path {
|
||||
case "/":
|
||||
return []string{"a", "g", "h"}, nil
|
||||
case "/a":
|
||||
return []string{"b", "f"}, nil
|
||||
case "/a/b":
|
||||
return []string{"c", "e"}, nil
|
||||
case "/a/b/c":
|
||||
return []string{"d"}, nil
|
||||
case "/a/b/c/d":
|
||||
return []string{"i", "j"}, nil
|
||||
case "/a/b/c/d/i":
|
||||
return []string{}, nil
|
||||
case "/a/b/c/d/j":
|
||||
return []string{}, nil
|
||||
case "/a/b/e":
|
||||
return []string{}, nil
|
||||
case "/a/f":
|
||||
return []string{}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
printMap = func(m map[string]*Node) {
|
||||
for k := range m {
|
||||
println(" >", k)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
|
||||
func TestBoundedTree(t *testing.T) {
|
||||
|
||||
// a/b/c/d/i
|
||||
// a/b/c/d/j
|
||||
// a/b/c/d
|
||||
// a/b/e
|
||||
// a/f
|
||||
// g
|
||||
// h
|
||||
|
||||
tree := NewBoundedTree()
|
||||
|
||||
tree.EnsureVisited(util.FullPath("/a/b/c"), visitFn)
|
||||
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b/c")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/c/d")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/f")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/g")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/h")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/x")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e/x")))
|
||||
|
||||
printMap(tree.root.Children)
|
||||
|
||||
a := tree.root.getChild("a")
|
||||
|
||||
b := a.getChild("b")
|
||||
if !b.isVisited() {
|
||||
t.Errorf("expect visited /a/b")
|
||||
}
|
||||
c := b.getChild("c")
|
||||
if !c.isVisited() {
|
||||
t.Errorf("expect visited /a/b/c")
|
||||
}
|
||||
|
||||
d := c.getChild("d")
|
||||
if d.isVisited() {
|
||||
t.Errorf("expect unvisited /a/b/c/d")
|
||||
}
|
||||
|
||||
tree.EnsureVisited(util.FullPath("/a/b/c/d"), visitFn)
|
||||
tree.EnsureVisited(util.FullPath("/a/b/c/d/i"), visitFn)
|
||||
tree.EnsureVisited(util.FullPath("/a/b/c/d/j"), visitFn)
|
||||
tree.EnsureVisited(util.FullPath("/a/b/e"), visitFn)
|
||||
tree.EnsureVisited(util.FullPath("/a/f"), visitFn)
|
||||
|
||||
printMap(tree.root.Children)
|
||||
|
||||
}
|
||||
|
||||
func TestEmptyBoundedTree(t *testing.T) {
|
||||
|
||||
// g
|
||||
// h
|
||||
|
||||
tree := NewBoundedTree()
|
||||
|
||||
visitFn := func(path util.FullPath) (childDirectories []string, err error) {
|
||||
fmt.Printf(" visit %v ...\n", path)
|
||||
switch path {
|
||||
case "/":
|
||||
return []string{"g", "h"}, nil
|
||||
}
|
||||
t.Fatalf("expected visit %s", path)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
tree.EnsureVisited(util.FullPath("/a/b"), visitFn)
|
||||
|
||||
tree.EnsureVisited(util.FullPath("/a/b"), visitFn)
|
||||
|
||||
printMap(tree.root.Children)
|
||||
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/g")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/g/x")))
|
||||
|
||||
}
|
||||
@@ -6,6 +6,22 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// BytesToHumanReadable returns the converted human readable representation of the bytes.
|
||||
func BytesToHumanReadable(b uint64) string {
|
||||
const unit = 1024
|
||||
if b < unit {
|
||||
return fmt.Sprintf("%d B", b)
|
||||
}
|
||||
|
||||
div, exp := uint64(unit), 0
|
||||
for n := b / unit; n >= unit; n /= unit {
|
||||
div *= unit
|
||||
exp++
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%.2f %ciB", float64(b)/float64(div), "KMGTPE"[exp])
|
||||
}
|
||||
|
||||
// big endian
|
||||
|
||||
func BytesToUint64(b []byte) (v uint64) {
|
||||
|
||||
@@ -5,5 +5,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 78)
|
||||
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 82)
|
||||
COMMIT = ""
|
||||
)
|
||||
|
||||
func Version() string {
|
||||
return VERSION + " " + COMMIT
|
||||
}
|
||||
@@ -49,6 +49,10 @@ func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Ti
|
||||
exists = false
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
glog.Errorf("check %s: %v", filename, err)
|
||||
return
|
||||
}
|
||||
if fi.Mode()&0400 != 0 {
|
||||
canRead = true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// HumanReadableIntsMax joins a serials of inits into a smart one like 1-3 5 ... for human readable.
|
||||
func HumanReadableIntsMax(max int, ids ...int) string {
|
||||
if len(ids) <= max {
|
||||
return HumanReadableInts(ids...)
|
||||
}
|
||||
|
||||
return HumanReadableInts(ids[:max]...) + " ..."
|
||||
}
|
||||
|
||||
// HumanReadableInts joins a serials of inits into a smart one like 1-3 5 7-10 for human readable.
|
||||
func HumanReadableInts(ids ...int) string {
|
||||
sort.Ints(ids)
|
||||
|
||||
s := ""
|
||||
start := 0
|
||||
last := 0
|
||||
|
||||
for i, v := range ids {
|
||||
if i == 0 {
|
||||
start = v
|
||||
last = v
|
||||
s = fmt.Sprintf("%d", v)
|
||||
continue
|
||||
}
|
||||
|
||||
if last+1 == v {
|
||||
last = v
|
||||
continue
|
||||
}
|
||||
|
||||
if last > start {
|
||||
s += fmt.Sprintf("-%d", last)
|
||||
}
|
||||
|
||||
s += fmt.Sprintf(" %d", v)
|
||||
start = v
|
||||
last = v
|
||||
}
|
||||
|
||||
if last != start {
|
||||
s += fmt.Sprintf("-%d", last)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHumanReadableIntsMax(t *testing.T) {
|
||||
assert.Equal(t, "1-2 ...", HumanReadableIntsMax(2, 1, 2, 3))
|
||||
assert.Equal(t, "1 3 ...", HumanReadableIntsMax(2, 1, 3, 5))
|
||||
}
|
||||
|
||||
func TestHumanReadableInts(t *testing.T) {
|
||||
assert.Equal(t, "1-3", HumanReadableInts(1, 2, 3))
|
||||
assert.Equal(t, "1 3", HumanReadableInts(1, 3))
|
||||
assert.Equal(t, "1 3 5", HumanReadableInts(5, 1, 3))
|
||||
assert.Equal(t, "1-3 5", HumanReadableInts(1, 2, 3, 5))
|
||||
assert.Equal(t, "1-3 5 7-9", HumanReadableInts(7, 9, 8, 1, 2, 3, 5))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package shell
|
||||
package exclusive_locks
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,6 +14,7 @@ const (
|
||||
RenewInteval = 4 * time.Second
|
||||
SafeRenewInteval = 3 * time.Second
|
||||
InitLockInteval = 1 * time.Second
|
||||
AdminLockName = "admin"
|
||||
)
|
||||
|
||||
type ExclusiveLocker struct {
|
||||
@@ -28,6 +29,9 @@ func NewExclusiveLocker(masterClient *wdclient.MasterClient) *ExclusiveLocker {
|
||||
masterClient: masterClient,
|
||||
}
|
||||
}
|
||||
func (l *ExclusiveLocker) IsLocking() bool {
|
||||
return l.isLocking
|
||||
}
|
||||
|
||||
func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) {
|
||||
for time.Unix(0, atomic.LoadInt64(&l.lockTsNs)).Add(SafeRenewInteval).Before(time.Now()) {
|
||||
@@ -38,12 +42,17 @@ func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) {
|
||||
}
|
||||
|
||||
func (l *ExclusiveLocker) RequestLock() {
|
||||
if l.isLocking {
|
||||
return
|
||||
}
|
||||
|
||||
// retry to get the lease
|
||||
for {
|
||||
if err := l.masterClient.WithClient(func(client master_pb.SeaweedClient) error {
|
||||
resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{
|
||||
PreviousToken: atomic.LoadInt64(&l.token),
|
||||
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
|
||||
LockName: AdminLockName,
|
||||
})
|
||||
if err == nil {
|
||||
atomic.StoreInt64(&l.token, resp.Token)
|
||||
@@ -67,6 +76,7 @@ func (l *ExclusiveLocker) RequestLock() {
|
||||
resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{
|
||||
PreviousToken: atomic.LoadInt64(&l.token),
|
||||
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
|
||||
LockName: AdminLockName,
|
||||
})
|
||||
if err == nil {
|
||||
atomic.StoreInt64(&l.token, resp.Token)
|
||||
@@ -92,6 +102,7 @@ func (l *ExclusiveLocker) ReleaseLock() {
|
||||
client.ReleaseAdminToken(context.Background(), &master_pb.ReleaseAdminTokenRequest{
|
||||
PreviousToken: atomic.LoadInt64(&l.token),
|
||||
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
|
||||
LockName: AdminLockName,
|
||||
})
|
||||
return nil
|
||||
})
|
||||
Reference in new issue
Block a user