时间:2021-07-01 10:21:17 帮助过:12人阅读
//file: org/apache/nutch/storage/WebPage.java//line: 42public class WebPage extends PersistentBase { public static final Schema _SCHEMA = Schema.parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.nutch.storage\",\"fields\":[{\"name\":\"baseUrl\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"int\"},{\"name\":\"fetchTime\",\"type\":\"long\"},{\"name\":\"prevFetchTime\",\"type\":\"long\"},{\"name\":\"fetchInterval\",\"type\":\"int\"},{\"name\":\"retriesSinceFetch\",\"type\":\"int\"},{\"name\":\"modifiedTime\",\"type\":\"long\"},{\"name\":\"prevModifiedTime\",\"type\":\"long\"},{\"name\":\"protocolStatus\",\"type\":{\"type\":\"record\",\"name\":\"ProtocolStatus\",\"fields\":[{\"name\":\"code\",\"type\":\"int\"},{\"name\":\"args\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"lastModified\",\"type\":\"long\"}]}},{\"name\":\"content\",\"type\":\"bytes\"},{\"name\":\"contentType\",\"type\":\"string\"},{\"name\":\"prevSignature\",\"type\":\"bytes\"},{\"name\":\"signature\",\"type\":\"bytes\"},{\"name\":\"title\",\"type\":\"string\"},{\"name\":\"text\",\"type\":\"string\"},{\"name\":\"parseStatus\",\"type\":{\"type\":\"record\",\"name\":\"ParseStatus\",\"fields\":[{\"name\":\"majorCode\",\"type\":\"int\"},{\"name\":\"minorCode\",\"type\":\"int\"},{\"name\":\"args\",\"type\":{\"type\":\"array\",\"items\":\"string\"}}]}},{\"name\":\"score\",\"type\":\"float\"},{\"name\":\"reprUrl\",\"type\":\"string\"},{\"name\":\"headers\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"inlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"markers\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"metadata\",\"type\":{\"type\":\"map\",\"values\":\"bytes\"}},{\"name\":\"batchId\",\"type\":\"string\"}]}");//..public Schema getSchema() { return _SCHEMA; }//...}
//file: org/apache/nutch/crawl/InjectorJob.java//InjectorJob.run(Map<String,Object>) line: 221 { DataStore<String, WebPage> store = StorageUtils.createWebStore(currentJob.getConfiguration(), String.class, WebPage.class);}
//file: gora-core-0.2.1/org/apache/gora/store/DataStoreFactory.java//DataStoreFactory.createDataStore(Class<D>, Class<K>, Class<T>, Configuration, String) line: 135 { return createDataStore(dataStoreClass, keyClass, persistent, conf, createProps(), schemaName);}
//file: gora-core-0.2.1/org/apache/gora/store/DataStoreBase.java//SqlStore<K,T>(DataStoreBase<K,T>).initialize(Class<K>, Class<T>, Properties) line: 81 { schema = this.beanFactory.getCachedPersistent().getSchema(); fieldMap = AvroUtils.getFieldMap(schema);}
//file: org/apache/nutch/crawl/InjectorJob.java//InjectorJob$UrlMapper.map(LongWritable, Text, Mapper<LongWritable,Text,String,Contex>) line: 191 { context.write(reversedUrl, row);}
//file: hadoop-src/org/apache/hadoop/mapred/MapTask.java//MapTask$NewDirectOutputCollector<K,V>.write(K, V) line: 638 { reporter.progress(); long bytesOutPrev = getOutputBytes(fsStats); out.write(key, value);}
//file: gora-core-0.2.1/org/apache/gora/mapreduce/GoraRecordWriter.java//GoraRecordWriter<K,T>.write(K, T) line: 60 { store.put(key, (Persistent) value);}
//file: gora-sql-0.1.1-incubating/org/apache/gora/sql/store/SqlStore.java//SqlStore<K,T>.put(K, T) line: 616 public void put(K key, T persistent) { List<Field> fields = schema.getFields(); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); Column column = mapping.getColumn(field.name()); insertStatement.setObject(persistent.get(i), field.schema(), column); } //jdbc already should cache the ps PreparedStatement insert = insertStatement.toStatement(connection); synchronized (writeCache) { writeCache.add(insert); } }
//file: gora-sql-0.1.1-incubating/org/apache/gora/sql/store/SqlStore.java//SqlStore<K,T>.setField(PreparedStatement, Column, Schema, int, Object) line: 718{ IOUtils.serialize(os, datumWriter, schema, object);}
//file: hadoop-src/org/apache/hadoop/mapred/MapTask.java//MapTask.runNewMapper(JobConf, TaskSplitIndex, TaskUmbilicalProtocol, TaskReporter) line: 767{ output.close(mapperContext);}//file: gora-core-0.2.1/org/apache/gora/mapreduce/GoraRecordWriter.java//GoraRecordWriter<K,T>.close(TaskAttemptContext) line: 55 { store.close();}
//file: gora-sql-0.1.1-incubating/org/apache/gora/sql/store/SqlStore.java//SqlStore<K,T>.flush() line: 342{ connection.commit();}
Nutch2 WebPage写入数据库的过程分析
标签:fetch prot time odi splay trie sync ati float