Skip to content

Commit 913819a

Browse files
committed
Merge branch 'new_gc' into discoproject
2 parents 9175f86 + 6bf6164 commit 913819a

20 files changed

+1959
-691
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ test: master $(ETESTOBJECTS)
120120

121121
dialyzer: EOPT = -W +debug_info
122122
dialyzer: $(EPLT)
123-
$(DIALYZER) --get_warnings -Wunmatched_returns -Werror_handling -Wbehaviours --plt $(EPLT) --src -r $(ESRC)
123+
$(DIALYZER) --get_warnings -Wunmatched_returns -Werror_handling --plt $(EPLT) --src -r $(ESRC)
124124

125125
typer: $(EPLT)
126126
$(TYPER) --plt $(EPLT) -r $(ESRC)

lib/disco/settings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@
222222
The default write authorization token to use.
223223
Default is ``None``.
224224
225+
.. envvar:: DDFS_GC_INITIAL_WAIT
226+
227+
The amount of time to wait after startup before running GC (in minutes).
228+
Default is ``''``, which triggers an internal default of 5 minutes.
229+
225230
.. envvar:: DDFS_PARANOID_DELETE
226231
227232
Instead of deleting unneeded files, DDFS garbage collector prefixes obsolete files with ``!trash.``, so they can be safely verified/deleted by an external process. For instance, the following command can be used to finally delete the files (assuming that ``DDFS_DATA = "/srv/disco/ddfs"``)::
@@ -307,7 +312,8 @@ class DiscoSettings(Settings):
307312
'DDFS_TAG_MIN_REPLICAS': "1",
308313
'DDFS_TAG_REPLICAS': "1",
309314
'DDFS_BLOB_REPLICAS': "1",
310-
'DDFS_PARANOID_DELETE': "''"
315+
'DDFS_PARANOID_DELETE': "''",
316+
'DDFS_GC_INITIAL_WAIT': "''"
311317
}
312318

313319
globals = globals()

master/src/ddfs/config.hrl

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
% How many replicas by default
1212
% -define(DEFAULT_REPLICAS, 3).
1313

14-
% How long to wait for replies from nodes
15-
-define(NODE_TIMEOUT, 5 * ?SECOND).
16-
1714
% How long ddfs node startup can take
1815
-define(NODE_STARTUP, 1 * ?MINUTE).
1916

17+
% How long to wait for replies from nodes
18+
-define(NODE_TIMEOUT, 10 * ?SECOND).
19+
2020
% How long to wait for a reply from and operation that accesses nodes
2121
% (>NODE_TIMEOUT)
2222
-define(NODEOP_TIMEOUT, 1 * ?MINUTE).
@@ -60,12 +60,33 @@
6060
% Time to wait between garbage collection runs
6161
-define(GC_INTERVAL, ?DAY).
6262

63+
% Max duration for a GC run. This should be smaller than
64+
% min(ORPHANED_{BLOB,TAG}_EXPIRES).
65+
-define(GC_MAX_DURATION, 3 * ?DAY).
66+
67+
% Time to wait after startup for cluster to stabilize before running
68+
% first GC.
69+
-define(GC_DEFAULT_INITIAL_WAIT, 5 * ?MINUTE).
70+
71+
% Maximum number of times we try to bring up a node that failed during
72+
% GC before we abort GC.
73+
-define(MAX_GC_NODE_FAILURES, 3).
74+
75+
% The longest potential interval between messages in the GC protocol;
76+
% used to ensure GC makes forward progress. This can be set to the
77+
% estimated time to traverse all the volumes on a DDFS node.
78+
-define(GC_PROGRESS_INTERVAL, 30 * ?MINUTE).
79+
6380
% Tag cache expires in this many milliseconds if tag can't be fetched
6481
-define(TAG_EXPIRES_ONERROR, 1 * ?SECOND).
6582

6683
% Number of tag replicas: min(length(Nodes), ?TAG_REPLICAS)
6784
% -define(TAG_REPLICAS, 3).
6885

86+
% Number of extra replicas (i.e. lost replicas recovered during GC) to
87+
% allow before deleting extra replicas.
88+
-define(NUM_EXTRA_REPLICAS, 1).
89+
6990
% Permissions for blobs and tags
7091
-define(FILE_MODE, 8#00400).
7192

@@ -94,19 +115,25 @@
94115
% Delete !partial leftovers after this many milliseconds
95116
-define(PARTIAL_EXPIRES, ?DAY).
96117

97-
% When orphaned blob can be deleted
118+
% When orphaned blob can be deleted
98119
-define(ORPHANED_BLOB_EXPIRES, 5 * ?DAY).
99120

100-
% When orphaned tag can be deleted
121+
% When orphaned tag can be deleted
101122
-define(ORPHANED_TAG_EXPIRES, 5 * ?DAY).
102123

103124
% How long a tag has to stay on the deleted list before
104125
% we can permanently forget it, after all known instances
105-
% of the tag object have been removed. This quarantine period
106-
% ensures that a node that was temporarily unavailable
126+
% of the tag object have been removed. This quarantine period
127+
% ensures that a node that was temporarily unavailable
107128
% and reactivates can't resurrect deleted tags. You
108129
% must ensure that all temporarily inactive nodes
109130
% are reactivated (or cleaned) within the ?DELETED_TAG_EXPIRES
110131
% time frame. To be on the safe side, make the period long
111132
% enough.
112133
-define(DELETED_TAG_EXPIRES, 30 * ?DAY).
134+
135+
% How many times a tag operation should be retried before aborting.
136+
-define(MAX_TAG_OP_RETRIES, 3).
137+
138+
% How long to wait before timing out a tag retrieval.
139+
-define(GET_TAG_TIMEOUT, 5 * ?MINUTE).

master/src/ddfs/ddfs.hrl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-type host() :: nonempty_string().
2+
-type path() :: nonempty_string().
3+
-type volume_name() :: nonempty_string().
4+
5+
% Diskinfo is {FreeSpace, UsedSpace}.
6+
-type diskinfo() :: {non_neg_integer(), non_neg_integer()}.
7+
-type volume() :: {diskinfo(), volume_name()}.
8+
9+
-type object_type() :: 'blob' | 'tag'.
10+
-type object_name() :: binary().
11+
-type url() :: binary().
12+
-type taginfo() :: {erlang:timestamp(), volume_name()}.

0 commit comments

Comments
 (0)